Skip to content

Instantly share code, notes, and snippets.

@arockwell
Created July 7, 2011 13:52
Show Gist options
  • Select an option

  • Save arockwell/1069559 to your computer and use it in GitHub Desktop.

Select an option

Save arockwell/1069559 to your computer and use it in GitHub Desktop.
Simple example of dynamically defining rake tasks
# Put this in a file called Rakefile
# To see all tasks:
# rake -T
# To run a task:
# rake task_a
my_tasks = [ "a", "b", "c" ]
my_tasks.each do |task|
desc "task a"
task "task_#{task}".intern do
puts task
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment