Created
November 20, 2008 05:34
-
-
Save motdotla/26950 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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