rake任务的问题

发布于 2024-09-16 06:48:46 字数 1218 浏览 4 评论 0原文

在使用参数运行 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

抱猫软卧 2024-09-23 06:48:46

rake 任务参数必须采用 name=value 格式,并且它尝试使用单个单词作为任务名称。

rake task parameters have to be formatted name=value, and it attempts to use single words as task names.

看轻我的陪伴 2024-09-23 06:48:46

我发现了问题..

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文