aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorXinhui2016-08-05 13:01:51 +0200
committerXinhui2016-08-05 13:01:51 +0200
commit5da381426eed3774f4eb17fe7ec104e9caf4eac2 (patch)
tree616c410b2b0f06c3db98b15ec0d72bf1555d713c /config
parent7cfd4faefab17e556ac66dd0e52c5942b289ec62 (diff)
downloadchouette-core-5da381426eed3774f4eb17fe7ec104e9caf4eac2.tar.bz2
Add gem Whenever
Diffstat (limited to 'config')
-rw-r--r--config/deploy.rb6
-rw-r--r--config/schedule.rb24
2 files changed, 30 insertions, 0 deletions
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