Ruby-on-rails 如何列出所有 Rails 3 rake 任务?rake -T 似乎不完整

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8711506/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 02:33:51  来源:igfitidea点击:

How to list all Rails 3 rake tasks? rake -T seems incomplete

ruby-on-railsrake

提问by Felix Rabe

Possible Duplicate:
Why is rake db:migrate:reset not listed in rake -T?

可能的重复:
为什么 rake db:migrate:reset 未在 rake -T 中列出?

Inside my Rails (3.1.3) application, I can run rake db:test:prepare. But when I run rake -T [db], that task (and many others I can use) does not show up.

在我的 Rails (3.1.3) 应用程序中,我可以运行rake db:test:prepare. 但是当我运行时rake -T [db],该任务(以及我可以使用的许多其他任务)不会出现。

How do I get a complete list of tasks, or why is it incomplete in the first place?

我如何获得完整的任务列表,或者为什么它首先不完整?

E.g. http://mindspill.net/computing/cross-platform-notes/ruby-on-rails/how-to-list-rake-tasks/shows that the 'db:test:prepare' task got listed for an older Rails version when running rails -T.

例如http://mindspill.net/computing/cross-platform-notes/ruby-on-rails/how-to-list-rake-tasks/显示 'db:test:prepare' 任务已针对较旧的 Rails 列出运行时的版本rails -T

回答by Felix Rabe

I found at Why is rake db:migrate:reset not listed in rake -T?(thanks @Beerlington for the link) that rake -Plists all tasks, which is what I was looking for.

我在为什么 rake db:migrate:reset 未在 rake -T 中列出?(感谢@Beerlington 提供链接)rake -P列出了所有任务,这正是我要找的。

回答by sevenseacat

Only tasks with descriptions set will appear in rake -T.

只有设置了描述的任务才会出现在 中rake -T

As for why not all tasks have descriptions.... that I don't know.

至于为什么不是所有的任务都有描述……我不知道。