README.md in clockwork-0.3.1 vs README.md in clockwork-0.3.2

- old
+ new

@@ -33,10 +33,35 @@ $ clockwork clock.rb Starting clock for 4 events: [ frequent.job less.frequent.job hourly.job midnight.job ] Triggering frequent.job +If you would not like to taint the namespace with `include Clockwork`, you can use +it as the module (thanks to [hoverlover](https://github.com/hoverlover/clockwork/)). + + require 'clockwork' + + module Clockwork + handler do |job| + puts "Running #{job}" + end + + every(10.seconds, 'frequent.job') + every(3.minutes, 'less.frequent.job') + every(1.hour, 'hourly.job') + + every(1.day, 'midnight.job', :at => '00:00') + end + +Quickstart for Heroku +--------------------- + +Clockwork fits well with heroku's cedar stack. + +Consider to use [clockwork-init.sh](https://gist.github.com/1312172) to create +a new project for heroku. + Use with queueing ----------------- The clock process only makes sense as a place to schedule work to be done, not to do the work. It avoids locking by running as a single process, but this @@ -67,9 +92,34 @@ require 'config/boot' require 'config/environment' every(1.hour, 'feeds.refresh') { Feed.send_later(:refresh) } every(1.day, 'reminders.send', :at => '01:30') { Reminder.send_later(:send_reminders) } + +Parameters +---------- + +### :at + +`:at` parameter the hour and minute specifies when the event occur. + +The simplest example: + + every(1.day, 'reminders.send', :at => '01:30') + +You can omit 0 of the hour: + + every(1.day, 'reminders.send', :at => '1:30') + +The wildcard for hour is supported: + + every(1.hour, 'reminders.send', :at => '**:30') + +You can set more than one timing: + + every(1.hour, 'reminders.send', :at => ['12:00', '18:00']) + # send reminders at noon and evening + Anatomy of a clock file ----------------------- clock.rb is standard Ruby. Since we include the Clockwork module (the