rake任务的问题
在使用参数运行 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
有什么解决办法吗?
While running rake task with parameters i am getting this problem.
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
Any Solution ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
rake 任务参数必须采用
name=value
格式,并且它尝试使用单个单词作为任务名称。rake task parameters have to be formatted
name=value
, and it attempts to use single words as task names.我发现了问题..
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
I found out problem..
C:\projects\Test1>rake test_rake_task csv_header csv_column
This is trying to find out other rake task csv_header which i don't have it.
And it's trying to build csv_header so it's returning error.
rake aborted!
Don't know how to build task 'csv_header'
That was not the proper way to pass parameters with Rake task..
If we want pass multiple parameter that we can pass it this way.
C:\projects\Test1>rake test_rake_task MODEL_NAMES=csv_header,csv_column