[ rake ] writing own rake task

lib/tasks/app/ns1.rake

namespace :app do

namespace :ns1 do
desc "TODO"
task :my_task_name1 => :environment do
end

desc "TODO"
task :my_task_name2, [:var1, :var2 ]=> :environment do

var1 = args[:var1] || 1.month.ago.beginning_of_day
end
end

end 

Execute

rake app:ns1:my_task_name1
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s