firstruby

Master ruby with us

Posts Tagged ‘rake’

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

Advertisements

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

Restrict rake routes listing to particular Controller in Ruby on Rails

Posted by firstruby on May 9, 2010

We can restrict the routes listing to particular CONTROLLER by passing CONTROLLER variable as,

rake routes CONTROLLER=profiles

Above command will display routes of profiles controller.

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