Skip to content

Instantly share code, notes, and snippets.

@beakr
Created January 12, 2014 22:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save beakr/8391560 to your computer and use it in GitHub Desktop.
Save beakr/8391560 to your computer and use it in GitHub Desktop.
Rake task arguments example with evil hacks
# 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