README.md in ruby-clock-0.6.0 vs README.md in ruby-clock-0.7.0

- old
+ new

@@ -14,10 +14,11 @@ The clock process will respond to signals INT (^c at the command line) and TERM (signal sent by environments such as Heroku and other PaaS's when shutting down). In both cases, the clock will stop running jobs and give existing jobs 29 seconds to stop before killing them. +You can change this number with `RUBY_CLOCK_SHUTDOWN_WAIT_SECONDS` in the environment. ## Installation Add these lines to your application's Gemfile: @@ -53,10 +54,15 @@ To start your clock process: bundle exec clock +To use a file other than Clockfile for job definitions, specify it. +This will ignore Clockfile and only read jobs from clocks/MyClockfile: + + bundle exec clock clocks/MyClockfile + ### Rails Install the `clock` binstub and commit to your repo. bundle binstubs ruby-clock @@ -81,10 +87,24 @@ ``` clock: bundle exec rails runner bin/clock ``` +You might have a main clock for general scheduled jobs, and then standalone ones +if your system has something where you want to monitor and adjust resources +for that work more precisely. Here, maybe the main clock needs a 2GB instance, +and the others each need 1GB all to themselves: + +``` +clock: bundle exec rails runner bin/clock +thing_checker: bundle exec rails runner bin/clock clocks/thing_checker.rb +thing_reporter: bundle exec rails runner bin/clock clocks/thing_reporter.rb +``` + +Because of this feature, do I regret using "Clockfile" instead of, say, "clock.rb"? Maybe. + + ## More Config and Capabilities ### Error Handling You can catch and report errors raised in your jobs by defining an error catcher at @@ -116,19 +136,19 @@ schedule.every '1 second', name: 'my job' do |variable| Foo.bar end # => my job -schedule.every '1 day', name: 'my job' do |variable| +schedule.every '1 day' do |variable| daily_things = Foo.setup_daily daily_things.process # TODO: figure out best time of day end # => daily_things.process # n.b. ruby-clock isn't yet smart enough to remove trailing comments -schedule.every '1 week', name: 'my job' do |variable| +schedule.every '1 week' do |variable| weekly_things = Foo.setup_weekly weekly_things.process # does this work???!1~ end # => weekly_things.process # does this work???!1~ ``` @@ -165,9 +185,17 @@ 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! + +## Syntax highlighting for Clockfile + +To tell github and maybe other systems to syntax highlight Clockfile, put this in a .gitattributes file: + +```gitattributes +Clockfile linguist-language=Ruby +``` ## License The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).