Created
January 12, 2014 22:31
-
-
Save beakr/8391560 to your computer and use it in GitHub Desktop.
Rake task arguments example with evil hacks
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
# From: http://itshouldbeuseful.wordpress.com/2011/11/07/passing-parameters-to-a-rake-task/ | |
def task_arg(var) | |
task var.to_sym {} | |
end | |
task :hello do | |
name = ARGV.last # Get last arg (ARGV.first is task name) | |
abort "I can't say hello to nobody. :(" if name.empty? | |
puts "Hello #{name}!" | |
task_arg(name) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment