I’d like my :default task in a Rakefile to be a helpful message that also includes the list of available tasks (the output of rake -T) for people who are not as familiar with rake.
How do you invoke rake -T from inside a task?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Invoking
rake -Tfrom within tasks is a bit more complicated in newer versions of rake. The options that need to be set may be derived fromrake/lib/application.rbin methodstandard_rake_options. Basically this boils down toNote that
record_task_metadatacannot be set from within the default task, as it will already be too late when the task is executed (descriptions won’t have been collected, thus those are nil and therefore no task matches the pattern). Trying to reload the Rakefile from within a task will lead to a closed loop. I assume there are performance trade ofs when always collecting metadata. If that’s an issuemight be more suitable.
Both work for me using rake 0.9.2.2.