Parameters can be passed in a rake by specifying key / value pairs in the rake command:
rake options:show opt1=value1
These command line options are then automatically set as environment variables that can be accessed as part of your task:
namespace :options do
desc "Show how to read in command line options"
task :show do
p "option1 is #{ENV['opt1']}"
end
end
source
share