Created
July 7, 2011 13:52
-
-
Save arockwell/1069559 to your computer and use it in GitHub Desktop.
Simple example of dynamically defining rake tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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