Monday, April 12, 2010

Rake default tasks when namespace presents

Rake, the Ruby version of make, is really elegant and powerful. Given the power and terseness of Ruby, it's really easy to build building scrips.

Normally when you type rake at command line, give you have everything installed correctly and a rake file under the same folder, the :default task is executed. But when you have namespaces to help organize the tasks, specifying the default task needs a little trick.

This is what you normally do
task :default => :build
task :build do ..... end

With namespaces, you have to use string, instead of symbol to specify the task name:
task :default => "build:build"
namespace :build do
task :build do ..... end

No comments:

Post a Comment