README.md in rekiq-0.0.1 vs README.md in rekiq-0.5.0
- old
+ new
@@ -13,62 +13,64 @@
Sidekiq is an amazing gem that allows us delegate time consuming work to a
worker, or even to schedule a time for the worker to start. Now wouldn't it be
nice if it also allowed us to schedule a worker to do work recurringly? That's
what rekiq purposes to do.
-In pratical means, rekiq allows you to schedule a worker to repeat the same
-work friday at 23:00, for example.
+For example, rekiq allows you to schedule a worker to repeat the same
+work every friday at 23:00.
-## Requirements
+## Dependencies
Tested with:
- * Ruby version 2.1.1, 2.0.0 and 1.9.3
- * Sidekiq 3.2.1
- * ice_cube 0.12.1
+ * ruby 2.1.1, 2.0.0 and 1.9.3
+ * sidekiq 3.2.1
## Installation
Add this line to your application's Gemfile:
- gem 'rekiq', git: 'https://github.com/junhanamaki/rekiq'
+ gem 'rekiq'
And then execute:
$ bundle
-Or compile source by hand, since for now it's not published.
+Or install it yourself as:
-## Usage
+ $ gem install rekiq
-Require rekiq after sidekiq:
+## Basic usage
- require 'sidekiq'
- require 'rekiq'
+1. Require rekiq after sidekiq:
-We need a 'schedule' object (responsible for returning the time at which the
+ require 'sidekiq'
+ require 'rekiq'
+
+2. We need a 'schedule' object (responsible for returning the time at which the
worker should start) which must respond to method next_occurrence and
-receives one argument of type Time more at [schedule](). For our example we'll use gem
-[ice_cube](https://github.com/seejohnrun/ice_cube) (don't forget to require it):
+receives one argument of type Time (more at [The schedule object](https://github.com/junhanamaki/rekiq/wiki/The-schedule-object)).
+For our example we'll be using the gem [ice_cube](https://github.com/seejohnrun/ice_cube)
+(don't forget to require it):
- # define worker as normal
- class ExampleWorker
- include Sidekiq::Worker
+ # define worker as normal
+ class ExampleWorker
+ include Sidekiq::Worker
- def perform(arg1, arg2)
- # Do some work
- end
- end
+ def perform(arg1, arg2)
+ # Do some work
+ end
+ end
- # create schedule for worker to repeat every friday at 2am
- schedule = IceCube::Schedule.new do |s|
- s.rrule IceCube::Rule.daily.day(:friday).hour_of_day(2)
- end
+ # create schedule for worker to repeat every friday at 2am
+ schedule = IceCube::Schedule.new do |s|
+ s.rrule IceCube::Rule.daily.day(:friday).hour_of_day(2)
+ end
- # now just start your worker
- ExampleWorker.perform_recurringly(schedule, 'argument_1', 'argument_2')
+ # now just start your worker
+ ExampleWorker.perform_recurringly(schedule, 'argument_1', 'argument_2')
-You can use your own schedule object, configure worker to reschedule before or
+ You can use your own schedule object, configure worker to reschedule before or
after work is done, set margin, and much more! So please check
[wiki](https://github.com/junhanamaki/rekiq/wiki) for more details.
## Contributing