3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/capistrano-deploy/whenever.rb', line 3
def self.load_into(configuration)
configuration.load do
set :whenever_cmd do
if using_recipe?(:bundle)
'bundle exec whenever'
else
'whenever'
end
end
set :whenever_identifier do
if using_recipe?(:multistage)
"#{application}_#{current_stage}"
else
application
end
end
namespace :whenever do
desc 'Update crontab file'
task :update_crontab, :roles => :db, :only => {:primary => true} do
run "cd #{deploy_to} && #{whenever_cmd} --update-crontab #{whenever_identifier}"
end
desc 'Clear crontab file'
task :clear_crontab, :roles => :db, :only => {:primary => true} do
run "cd #{deploy_to} && #{whenever_cmd} --clear-crontab #{whenever_identifier}"
end
end
end
end
|