Using the --rules option to trace the rule resolution
The relationship between tasks becomes the most difficult when the tasks are rules. In this case, a rule
task may be suited for many task names. For example, when the rule specifies a regular expression instead of a name. In this case, the rules that were described previously won't help us anyway.
When you run a task that was accepted by a rule, it's very useful to know which task will be executed and in which order. Rake provides us with a --rules
option to show us a rule's resolution. Take a look at the following Rakefile
from
Chapter 3, Working with Rules:
require 'rake/clean' BOOK = 'book/book.asc' CHAPTERS = FileList['book/*.asc'].exclude(BOOK) DOCX_OUTPUT = 'output/%n.docx' ODT_OUTPUT = 'output/%n.odt' CLEAN.include('output/*.html') CLOBBER.include('output') namespace :generate do directory 'output' desc 'Generate only one article with given number' task :article, [:number] do |t, args| num = args.number article...