understanding rake tasks

Posted . Visible to the public.

Rake is a build language (like make and ant), an internal DSL build in Ruby language.

task :task_name => [:clean] do
  ## ruby code comes here
  ## ruby code comes here
  ## ruby code comes here
end

task is a method that accepts two parameters, a hash and a block. The key in the hash is task name and the value is an array which contains the dependencies (optional). You can remove the square braces in case of single dependency and the value for the hash can be removed in case of no dependency.

The dependencies are executed first and then the task code specified in the block.

Sandheep
Posted by Sandheep to Sandheep's deck (2013-04-29 08:10)