Skip to content

Instantly share code, notes, and snippets.

@motdotla
Created November 20, 2008 05:35
Show Gist options
  • Save motdotla/26951 to your computer and use it in GitHub Desktop.
Save motdotla/26951 to your computer and use it in GitHub Desktop.
namespace :chores do
task :each_minute => :environment do
chore("Each minute") do
# our code will go here
end
end
task :hourly => :environment do
chore("Hourly") do
# code here
end
end
task :daily => :environment do
chore("Daily") do
# code here
end
end
task :weekly => :environment do
chore("Weekly") do
# code here
end
end
def chore(name)
puts "#{name} Task Invoked: #{Time.now}"
yield
puts "#{name} Task Finished: #{Time.now}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment