gpt4 book ai didi

rake - 未初始化的常量 Rake::Pipeline::ManifestEntry::DateTime

转载 作者:行者123 更新时间:2023-12-04 05:29:03 27 4
gpt4 key购买 nike

我不是一个 ruby 人,我正在使用 Ember.js 开发一个项目,我正在使用 Rake 管道来编译我的脚本。

# AssetFile
$: << 'lib'

require 'rake-pipeline-web-filters'

output BUILD
input SRC_DIR do
match '**/*.handlebars' do
handlebars :precompile => true
concat 'templates.js'
end

match '**/*.coffee' do
coffee_script
end
end

output JS_DIR
input BUILD_DIR do
match '*.js' do
concat 'app.js'
end
end

当我在控制台上执行 rakep 第一次工作正常但第二次我得到一个 const_missing错误
c:/Ruby193/lib/ruby/1.9.1/rake/ext/module.rb:36:in `const_missing': uninitialized constant Rake::Pipeline::ManifestEntry::DateTime (NameError)
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-pipeline-0.7.0/lib/rake-pipeline/manifest_entry.rb:9:in `from_hash'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-pipeline-0.7.0/lib/rake-pipeline/manifest.rb:24:in `block in read_manifest'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-pipeline-0.7.0/lib/rake-pipeline/manifest.rb:23:in `each'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-pipeline-0.7.0/lib/rake-pipeline/manifest.rb:23:in `read_manifest'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-pipeline-0.7.0/lib/rake-pipeline/project.rb:225:in `last_manifest'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-pipeline-0.7.0/lib/rake-pipeline/filter.rb:219:in `create_file_task'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-pipeline-0.7.0/lib/rake-pipeline/filter.rb:197:in `block (2 levels) in generate_rake_tasks'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-pipeline-0.7.0/lib/rake-pipeline/filter.rb:196:in `each'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-pipeline-0.7.0/lib/rake-pipeline/filter.rb:196:in `block in generate_rake_tasks'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-pipeline-0.7.0/lib/rake-pipeline/filter.rb:194:in `each'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-pipeline-0.7.0/lib/rake-pipeline/filter.rb:194:in `map'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-pipeline-0.7.0/lib/rake-pipeline/filter.rb:194:in `generate_rake_tasks'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-pipeline-0.7.0/lib/rake-pipeline.rb:410:in `block in generate_rake_tasks'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-pipeline-0.7.0/lib/rake-pipeline.rb:407:in `each'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-pipeline-0.7.0/lib/rake-pipeline.rb:407:in `generate_rake_tasks'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-pipeline-0.7.0/lib/rake-pipeline.rb:333:in `setup'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-pipeline-0.7.0/lib/rake-pipeline.rb:308:in `block in invoke'
from <internal:prelude>:10:in `synchronize'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-pipeline-0.7.0/lib/rake-pipeline.rb:305:in `invoke'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-pipeline-0.7.0/lib/rake-pipeline/project.rb:111:in `each'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-pipeline-0.7.0/lib/rake-pipeline/project.rb:111:in `block in invoke'
from <internal:prelude>:10:in `synchronize'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-pipeline-0.7.0/lib/rake-pipeline/project.rb:110:in `invoke'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-pipeline-0.7.0/lib/rake-pipeline/cli.rb:19:in `build'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/thor-0.16.0/lib/thor/task.rb:27:in `run'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/thor-0.16.0/lib/thor/invocation.rb:120:in `invoke_task'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/thor-0.16.0/lib/thor.rb:275:in `dispatch'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/thor-0.16.0/lib/thor/base.rb:425:in `start'
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rake-pipeline-0.7.0/bin/rakep:4:in `<top (required)>'
from c:/Ruby193/bin/rakep:23:in `load'
from c:/Ruby193/bin/rakep:23:in `<main>'

当我手动删除文件或让时间消逝时,rakep 命令工作正常

备注 :我在对文件进行排序以连接时也遇到问题

最佳答案

我刚刚遇到了同样的问题。我正在使用 rake-pipeline 来缩小静态站点的样式表。

这里发生的事情是 rake-pipeline 试图使用 DateTime 解析日期时间。类,但由于您不是在 Ruby 项目上工作,因此该类不可用。我猜是因为 rake-pipeline 主要用于 Ruby 项目,当时没有人注意到这是一个问题。我可以看到 this problem has been fixed on the master branch ,但尚未发布新的 gem 版本。

同时,您可以将以下代码添加到您的 Assetfile(在您的输入和输出之前),这将在您的过滤器运行之前删除 tmp 目录。这只是一个临时修复,因为这意味着您的输入每次都会被过滤,无论它们是否已更改,但它确实不需要任何狡猾的日期时间解析。

require 'fileutils'
FileUtils.rm_rf 'tmp'

小心 rm_rf !确保它指向您的 tmp 目录而不是其他任何目录。

回复:整理您的文件,我不知道您的问题的具体情况,但您可能会发现 this example有帮助。

关于rake - 未初始化的常量 Rake::Pipeline::ManifestEntry::DateTime,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12866054/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com