Wednesday, December 13, 2006

Rake: --dry-run, --trace, and -T

When using rake it can often be useful to know the order in which tasks are being executed. To list the execution order you can issue the following command.
rake --dry-run
The --dry-run option works well; however, it does not report tasks that are explicitly invoked.
Rake::Task["test:units"].invoke
The above code can be used to explicitly invoke a task (test:units in the example). Rails uses this in various database and testing tasks. However, it's still possible to see which tasks are being executed. The following code will show each task as it's executed.
rake --trace
The --trace option provides a lot of information, but if you have grep available it can be trimmed down easily.
rake --trace | grep Execute
Also, when running rake with the -T option you can also pass another parameter to list only the commands that contain that parameter. For example, the following code returns all the tasks that contain 'db' in their description.
rake -T db

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.