我不是一个红宝石人,我正在与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命令工作正常
注意:我在排序要连接的文件时遇到问题
答案 0 :(得分:3)
我遇到了同样的问题。我正在使用rake-pipeline来缩小静态站点的样式表。
这里发生的事情是rake-pipeline正在尝试使用DateTime
类解析日期时间,但由于您没有使用Ruby项目,因此该类不可用。我想因为rake-pipeline主要用于Ruby项目,没有人注意到这是当时的一个问题。我可以看到this problem has been fixed on the master branch,但尚未发布新的宝石版本。
与此同时,您可以将以下代码添加到Assetfile中(在输入和输出之前),这将在过滤器运行之前删除tmp目录。这只是一个临时修复,因为它意味着您的输入每次都会被过滤,无论它们是否已经改变,但它确实否定了任何狡猾的日期时间解析的需要。
require 'fileutils'
FileUtils.rm_rf 'tmp'
小心rm_rf
!确保它指向你的tmp目录,没有别的。
Re:排序文件,我不知道问题的具体细节,但您可能会发现this example有帮助。