Monday, November 22, 2010

Rake duplicate task descriptions

Using Rake I can define tasks that get added to a collection of tasks for execution.  For example:
desc "one"
task :one do
  puts "one"
end

desc "all"
task :all => [:one]

desc "two"
task :two do
  puts "two"
end

desc "all"
task :all => [:two]

Now, if I look at rake --tasks I will see:
> rake --tasks
rake one     # one
rake two     # two
rake all     # all / all

Rake has duplicated the description for the :all task. Looking at the code for Rake I discovered that this can be avoided by terminating the :all task description with a period:
desc "one"
desc "all."
task :all => [:one]

desc "one"
desc "all."
task :all => [:one]

> rake --tasks
rake one     # one
rake two     # two
rake all     # all.

No comments :

Post a Comment