在使用参数运行rake任务时,我遇到了这个问题。
C:\projects\Test1>rake test_rake_task csv_header csv_column
(in C:/projects/CyncErp)
** Invoke annotate_models (first_time)
** Execute annotate_models
krunal get_model_names
model_name = csv_header
model_name = csv_column
rake aborted!
Don't know how to build task 'csv_header'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1728:in `[]'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2050:in `invoke_task'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exceptio
n_handling'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exceptio
n_handling'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
c:/ruby/bin/rake:19:in `load'
c:/ruby/bin/rake:19
任何解决方案?
答案 0 :(得分:2)
rake任务参数必须格式为name=value
,并尝试将单个单词用作任务名称。
答案 1 :(得分:0)
我发现了问题..
C:\ projects \ Test1> rake test_rake_task csv_header csv_column
这是试图找出我没有的其他rake任务csv_header。
它正在尝试构建csv_header,以便返回错误。
耙子流产了! 不知道如何构建任务'csv_header'这不是使用Rake任务传递参数的正确方法..
如果我们想传递多个参数,我们可以这样传递它。
C:\ projects \ Test1> rake test_rake_task MODEL_NAMES = csv_header,csv_column