diff --git a/CHANGELOG.rdoc b/CHANGELOG.md similarity index 87% rename from CHANGELOG.rdoc rename to CHANGELOG.md index 2ae80ea..79e4afe 100644 --- a/CHANGELOG.rdoc +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -== 0.6.1 / October 20th, 2010 +### 0.6.1 / October 20th, 2010 * Detect script/rails file and change runner to Rails 3 style if found. [Javan Makhmali] @@ -7,14 +7,14 @@ * Added a built-in Capistrano recipe. [Javan Makhmali] -== 0.5.3 / September 24th, 2010 +### 0.5.3 / September 24th, 2010 * Better regexes for replacing Whenever blocks in the crontab. #45 [Javan Makhmali] * Preserving backslashes when updating existing crontab. #82 [Javan Makhmali] -== 0.5.2 / September 15th, 2010 +### 0.5.2 / September 15th, 2010 * Quotes automatically escaped in jobs. [Jay Adkisson] @@ -25,7 +25,7 @@ * Lots of internal reorganizing; tests broken into unit and functional. [Javan Makhmali] -== 0.5.0 / June 28th, 2010 +### 0.5.0 / June 28th, 2010 * New job_type API for writing custom jobs. Internals use this to define command, runner, and rake. [Javan Makhmali - inspired by idlefingers (Damien)] @@ -34,7 +34,7 @@ * --clear option to remove crontab entries for a specific [identifier]. [mraidel (Michael Raidel)] -== 0.4.2 / April 26th, 2010 +### 0.4.2 / April 26th, 2010 * runners now cd into the app's directory and then execute. [Michael Guterl] @@ -45,49 +45,49 @@ * bugfix: comparison Time with 0 failed. #32 [Dan Hixon] -== 0.4.1 / November 30th, 2009 +### 0.4.1 / November 30th, 2009 * exit(0) instead of just exit to make JRuby happy. [Elan Meng] * Fixed activesupport deprecation warning by requiring active_support. #37 [Andrew Nesbitt] -== 0.4.0 / October 20th, 2009 +### 0.4.0 / October 20th, 2009 * New output option replaces the old cron_log option for output redirection and is much more flexible. #31 [Peer Allan] * Reorganized the lib files (http://weblog.rubyonrails.org/2009/9/1/gem-packaging-best-practices) and switched to Jeweler from Echoe. -== 0.3.7 / September 4th, 2009 +### 0.3.7 / September 4th, 2009 * No longer tries (and fails) to combine @shortcut jobs. #20 [Javan Makhmali] -== 0.3.6 / June 15th, 2009 +### 0.3.6 / June 15th, 2009 * Setting a PATH in the crontab automatically based on the user's PATH. [Javan Makhmali] -== 0.3.5 / June 13th, 2009 +### 0.3.5 / June 13th, 2009 * Added ability to accept lists of every's and at's and intelligently group them. (ex: every 'monday, wednesday', :at => ['3pm', '6am']). [Sam Ruby] * Fixed issue with new lines. #18 [Javan Makhmali] -== 0.3.1 / June 25th, 2009 +### 0.3.1 / June 25th, 2009 * Removed activesupport gem dependency. #1 [Javan Makhmali] * Switched to numeric days of the week for Solaris support (and probably others). #8 [Roger Ertesvåg] -== 0.3.0 / June 2nd, 2009 +### 0.3.0 / June 2nd, 2009 * Added ability to set variables on the fly from the command line (ex: whenever --set environment=staging). [Javan Makhmali] -== 0.2.2 / April 30th, 2009 +### 0.2.2 / April 30th, 2009 * Days of week jobs can now accept an :at directive (ex: every :monday, :at => '5pm'). [David Eisinger] @@ -96,22 +96,22 @@ * Raising an exception if someone tries to specify an :at with a cron shortcut (:day, :reboot, etc) so there are no false hopes. [Javan Makhmali] -== 0.1.7 / March 5th, 2009 +### 0.1.7 / March 5th, 2009 * Added ability to update the crontab file non-destuctively instead of only overwriting it. [Javan Makhmali -- Inspired by code submitted individually from: Tien Dung (tiendung), Tom Lea (cwninja), Kyle Maxwell (fizx), and Andrew Timberlake (andrewtimberlake) on github] -== 0.1.5 / February 19th, 2009 +### 0.1.5 / February 19th, 2009 * Fixed load path so Whenever's files don't conflict with anything in Rails. Thanks Ryan Koopmans. [Javan Makhmali] -== 0.1.4 / February 17th, 2009 +### 0.1.4 / February 17th, 2009 * Added --load-file and --user opts to whenever binary. [Javan Makhmali] -== 0.1.3 / February 16th, 2009 +### 0.1.3 / February 16th, 2009 * Added 'rake' helper for defining scheduled rake tasks. [Javan Makhmali] @@ -124,6 +124,6 @@ * Requiring specific gem versions: Chronic >=0.2.3 and activesupport >= 1.3.0 [Javan Makhmali] -== 0.1.0 / February 15th, 2009 +### 0.1.0 / February 15th, 2009 * Initial release [Javan Makhmali] \ No newline at end of file diff --git a/README.rdoc b/README.md similarity index 54% rename from README.rdoc rename to README.md index dec4f4d..1477e7f 100644 --- a/README.rdoc +++ b/README.md @@ -1,119 +1,119 @@ -== Introduction +### Introduction Whenever is a Ruby gem that provides a clear syntax for writing and deploying cron jobs. -== Installation +### Installation - $ gem install whenever + $ gem install whenever Or with Bundler in your Gemfile. - gem 'whenever', :require => false + gem 'whenever', :require => false -== Getting started +### Getting started - $ cd /my/rails/app - $ wheneverize . + $ cd /my/rails/app + $ wheneverize . This will create an initial "config/schedule.rb" file you. -== Example schedule.rb file +### Example schedule.rb file - every 3.hours do - runner "MyModel.some_process" - rake "my:rake:task" - command "/usr/bin/my_great_command" - end + every 3.hours do + runner "MyModel.some_process" + rake "my:rake:task" + command "/usr/bin/my_great_command" + end - every 1.day, :at => '4:30 am' do - runner "MyModel.task_to_run_at_four_thirty_in_the_morning" - end + every 1.day, :at => '4:30 am' do + runner "MyModel.task_to_run_at_four_thirty_in_the_morning" + end - every :hour do # Many shortcuts available: :hour, :day, :month, :year, :reboot - runner "SomeModel.ladeeda" - end + every :hour do # Many shortcuts available: :hour, :day, :month, :year, :reboot + runner "SomeModel.ladeeda" + end - every :sunday, :at => '12pm' do # Use any day of the week or :weekend, :weekday - runner "Task.do_something_great" - end + every :sunday, :at => '12pm' do # Use any day of the week or :weekend, :weekday + runner "Task.do_something_great" + end -More examples on the wiki: http://wiki.github.com/javan/whenever/instructions-and-examples +More examples on the wiki: -== Define your own job types +### Define your own job types Whenever ships with three pre-defined job types: command, runner, and rake. You can define your own with `job_type`. For example: - job_type :awesome, '/usr/local/bin/awesome :task :fun_level' + job_type :awesome, '/usr/local/bin/awesome :task :fun_level' - every 2.hours do - awesome "party", :fun_level => "extreme" - end + every 2.hours do + awesome "party", :fun_level => "extreme" + end Would run `/usr/local/bin/awesome party extreme` every two hours. `:task` is always replaced with the first argument, and any additional `:whatevers` are replaced with the options passed in or by variables that have been defined with `set`. The default job types that ship with Whenever are defined like so: - job_type :command, ":task :output" - job_type :rake, "cd :path && RAILS_ENV=:environment rake :task :output" - job_type :runner, "cd :path && script/runner -e :environment ':task' :output" + job_type :command, ":task :output" + job_type :rake, "cd :path && RAILS_ENV=:environment rake :task :output" + job_type :runner, "cd :path && script/runner -e :environment ':task' :output" If a script/rails file is detected (like in a Rails 3 app), runner will be defined to fit: - job_type :runner, "cd :path && script/rails runner -e :environment ':task' :output" + job_type :runner, "cd :path && script/rails runner -e :environment ':task' :output" -If a `:path` is not set it will default to the directory in which `whenever` was executed. `:environment` will default to 'production'. `:output` will be replaced with your output redirection settings which you can read more about here: http://github.com/javan/whenever/wiki/Output-redirection-(logging-your-cron-jobs) +If a `:path` is not set it will default to the directory in which `whenever` was executed. `:environment` will default to 'production'. `:output` will be replaced with your output redirection settings which you can read more about here: -All jobs are by default run with `bash -l -c 'command...'`. Among other things, this allows your cron jobs to play nice with RVM by loading the entire environment instead of cron's somewhat limited environment. Read more: http://blog.scoutapp.com/articles/2010/09/07/rvm-and-cron-in-production +All jobs are by default run with `bash -l -c 'command...'`. Among other things, this allows your cron jobs to play nice with RVM by loading the entire environment instead of cron's somewhat limited environment. Read more: -You can change this by setting your own job_template. +You can change this by setting your own `:job_template`. - set :job_template, "bash -l -c ':job'" + set :job_template, "bash -l -c ':job'" Or set the job_template to nil to have your jobs execute normally. - set :job_template, nil + set :job_template, nil And you'll see your schedule.rb converted to cron sytax. Note: running `whenever` with no options does not display your current crontab file, it simply shows you the output of converting your schedule.rb file. -== Capistrano integration +### Capistrano integration Use the built-in Capistrano recipe for easy crontab updates with deploys. In your "config/deploy.rb" file: - require "whenever/capistrano" + require "whenever/capistrano" -Take a look at the recipe for options you can set. http://github.com/javan/whenever/blob/master/lib/whenever/capistrano.rb +Take a look at the recipe for options you can set. For example, if you're using bundler do this: - set :whenever_command, "bundle exec whenever" - require "whenever/capistrano" + set :whenever_command, "bundle exec whenever" + require "whenever/capistrano" -== The `whenever` command +### The `whenever` command - $ cd /my/rails/app - $ whenever + $ cd /my/rails/app + $ whenever This will simply show you your schedule.rb file converted to cron syntax. It does not read or write your crontab file. Run `whenever --help` for a complete list of options. -== Credit +### Credit -Whenever was created for use at Inkling (http://inklingmarkets.com) where I work. Their take on it: http://blog.inklingmarkets.com/2009/02/whenever-easy-way-to-do-cron-jobs-from.html +Whenever was created for use at Inkling () where I work. Their take on it: -While building Whenever, I learned a lot by digging through the source code of Capistrano - http://github.com/jamis/capistrano +Thanks to all the contributors who have made it even better: -== Discussion / Feedback / Issues / Bugs +### Discussion / Feedback / Issues / Bugs -For general discussion and questions, please use the google group: http://groups.google.com/group/whenever-gem +For general discussion and questions, please use the google group: -If you've found a genuine bug or issue, please use the Issues section on github: http://github.com/javan/whenever/issues +If you've found a genuine bug or issue, please use the Issues section on github: -Ryan Bates created a great Railscast about Whenever: http://railscasts.com/episodes/164-cron-in-ruby +Ryan Bates created a great Railscast about Whenever: It's a little bit dated now, but remains a good introduction. -== License +### License Copyright (c) 2009+ Javan Makhmali