简体   繁体   English

Rails耙任务不起作用

[英]Rails rake task doesn't work

I try add file random.rake to my /lib/tasks folder but after that when i type rake -T I don't see rake random on the list. 我尝试将文件random.rake添加到我的/lib/tasks文件夹中,但是在此之后,当我键入rake -T我在列表上没有看到rake random I try save few files but without any results. 我尝试保存一些文件,但没有任何结果。

task :greet do
   puts "How are you?"
end

I have ruby 1.9.3 rails 3.2.13 rake 10.1.0 我有红宝石1.9.3导轨3.2.13耙10.1.0

What I can do? 我可以做什么?

You need to add some description to your task: 您需要在任务中添加一些描述:

desc "Some description here"
task :greet do
  puts "How are you?"
end

Easy way to check the presence of the task if you have many tasks: 如果您有许多任务,检查任务是否存在的简便方法:

$ rake -T | grep greet

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM