firstruby

Master ruby with us

Archive for October, 2011

How to pass command line argument to Rake task

Posted by firstruby on October 2, 2011

Following is the way to pass command line argument to Rake task,

rake app:test argument_name=’Hello World’

And read command line argument in following rake task,

namespace :app do
desc ‘test’
task :test => :environment do |t|
puts ENV[‘argument_name’]
end
end

Posted in Useful Links | Tagged: | Leave a Comment »