Just a quick tip:
File: gistfile1.rb
——————
desc "Rake task with arguments and :environment"
task :task_name, [:arg1, :arg2] => :environment do |t,
args|
args.with_defaults(:arg1 => "Foo", :arg2 => "Bar")
puts "Hello, #{args.arg1}. Bye, #{args.arg2}."
end
Notes:
- You may omit the #with_defaults call.
- You have to use an Array for your arguments, even if there is only one.
So you will be able to pass arguments to your rake task:
File: gistfile1.txt
——————-
$ rake task_name["Moon","Sun"]
Hello, Moon. Bye, Sun.