25
Is there a way to pass named arguments to a Rake task without using environment variables?
I am aware that Rake tasks can accept arguments in two formats:
Environment Variables
$ rake my_task foo=bar
This creates an environment variable with the name foo and the value bar that can be accessed in the Rake task my_task by ENV['foo'].
Rake Task Arguments
$ rake my_task['foo','bar']
This passes the values foo and bar to the first two task arguments (if they are defined). If my_task were defined as:
task :my_task, :argument_1, :argument_2
then argument_1 would have the value foo and argument_2 would have the value bar.