I know in Ant / Nant you can pass an argument like -projecthelp to get a list of avaialbe targets with descriptions.
Is there a similar command-line argument for doing this with a rakefile's t开发者_运维技巧asks?
Also is there a way to generate documentation from the rakefile itself?
rake -T
lists tasks
rake --help
shows other options
They are not necessarily 'targets' in Rakefiles though, they are just actions. Look at RDoc for documenting Ruby code
rake -P
Displays tasks and dependencies.
rake -T
Displays tasks and descriptions
rake -T [PATTERN]
Displays tasks and descriptions filtered by that PATTERN. A pattern might be anything from namespace:task_name
without the leading rake
and without the prepended # comment
(your desc
from above a task/method).
# Example
namespace :example do
# ^ searchable
desc "Some task doing things"
task :example do
# ^ searchable
puts "Hello world"
end
end
精彩评论