README.md in ruby-clock-0.1.0 vs README.md in ruby-clock-0.2.0
- old
+ new
@@ -21,14 +21,10 @@
Add these lines to your application's Gemfile:
```ruby
gem 'ruby-clock'
-
-# ruby-clock currently depends on rufus-scheduler master
-git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
-gem 'rufus-scheduler', github: 'jmettraux/rufus-scheduler'
```
And then execute:
$ bundle install
@@ -37,21 +33,22 @@
$ gem install ruby-clock
## Usage
-Write a file with your scheduled jobs in it, named Clockfile. The DSL and capabilities
+Create a file named Clockfile. This will hold your job definitions.
+The DSL and capabilities
are the same as those of [rufus-scheduler](https://github.com/jmettraux/rufus-scheduler/).
Read the rufus-scheduler documentation to see what you can do.
```ruby
schedule.every('5 minutes') do
UserDataReports.generate
end
# do something every day, five minutes after midnight
-scheduler.cron '5 0 * * *' do
+schedule.cron '5 0 * * *' do
DailyActivitySummary.generate_and_send
end
```
To start your clock process:
@@ -84,19 +81,28 @@
## More Config and Capabilities
### Error Handling
-todo
+You can catch and report errors raised in your jobs by defining an error catcher at
+the top of your Clockfile like this:
+```ruby
+def schedule.on_error(job, error)
+ ErrorReporter.track_exception(error)
+end
+```
+
### Callbacks
-todo
+You can define before, after, and around callbacks which will run for all jobs.
+Read [the rufus-scheduler documentation](https://github.com/jmettraux/rufus-scheduler/#callbacks)
+to learn how to do this. Where the documentation references `s`, you should use `schedule`.
-### rufus-scheduler Options
+### other rufus-scheduler Options
All rufus-scheduler options are set to defaults. The `schedule` variable
-Available in your Clockfile is and instance of `Rufus::Scheduler`,
+available in your Clockfile is an instance of `Rufus::Scheduler`,
so anything you can do on this instance, you can do in your Clockfile.
Perhaps in the future ruby-clock will add some easier specific configuration
capabilities for some things. Let me know if you have a request!