diff options
| -rw-r--r-- | Gemfile | 1 | ||||
| -rw-r--r-- | Gemfile.lock | 4 | ||||
| -rw-r--r-- | config/deploy.rb | 6 | ||||
| -rw-r--r-- | config/schedule.rb | 24 | 
4 files changed, 35 insertions, 0 deletions
| @@ -102,6 +102,7 @@ gem 'acts_as_tree', '~> 2.1.0', require: 'acts_as_tree'  gem 'rabl'  gem 'delayed_job_active_record' +gem 'whenever', require: false  gem 'devise-async'  gem 'apartment', '~> 1.0.0' diff --git a/Gemfile.lock b/Gemfile.lock index c9ad505a2..0cc9c4685 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -85,6 +85,7 @@ GEM      celluloid (0.16.0)        timers (~> 4.0.0)      choice (0.1.7) +    chronic (0.10.2)      cliver (0.3.2)      cocoon (1.2.6)      coderay (1.1.0) @@ -482,6 +483,8 @@ GEM      websocket-driver (0.5.3-java)        websocket-extensions (>= 0.1.0)      websocket-extensions (0.1.2) +    whenever (0.9.4) +      chronic (>= 0.6.3)      will_paginate (3.0.7)      will_paginate-bootstrap (1.0.1)        will_paginate (>= 3.0.3) @@ -589,6 +592,7 @@ DEPENDENCIES    turbolinks    uglifier (~> 2.7.2)    webmock +  whenever    will_paginate (~> 3.0.7)    will_paginate-bootstrap (~> 1.0.1) diff --git a/config/deploy.rb b/config/deploy.rb index ce41e5971..4b79cfa5b 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -21,6 +21,12 @@ set :copy_exclude, [ '.git' ]  ssh_options[:forward_agent] = true  require "bundler/capistrano" +require "whenever/capistrano" + +# Whenever +set :whenever_command, "bundle exec whenever" +set :whenever_environment, -> { fetch(:stage) } +set :whenever_identifier, -> { "#{fetch(:application)}_#{fetch(:stage)}" }  namespace :deploy do    task :start do ; end diff --git a/config/schedule.rb b/config/schedule.rb new file mode 100644 index 000000000..eff775294 --- /dev/null +++ b/config/schedule.rb @@ -0,0 +1,24 @@ +# Use this file to easily define all of your cron jobs. +# +# It's helpful, but not entirely necessary to understand cron before proceeding. +# http://en.wikipedia.org/wiki/Cron + +# Example: +# +# set :output, "/path/to/my/cron_log.log" +# +# every 2.hours do +#   command "/usr/bin/some_great_command" +#   runner "MyModel.some_method" +#   rake "some:great:rake:task" +# end +# +# every 4.days do +#   runner "AnotherModel.prune_old_records" +# end + +# Learn more: http://github.com/javan/whenever + +every :hour do +  rake "organisations:sync" +end | 
