This repository has been archived by the owner on Jun 29, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
capistrano.rb
44 lines (35 loc) · 1.51 KB
/
capistrano.rb
1
2
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
34
35
36
37
38
39
40
41
42
43
44
require 'resque_utils'
Capistrano::Configuration.instance(:must_exist).load do
namespace :resque do
namespace :failed do
desc "Requeue all failed jobs"
task :requeue_all do
set :resque_pre, "cd #{current_path} && RAILS_ENV=#{environment} bundle exec rails runner"
run "#{resque_pre} 'ResqueUtils::requeue_all'"
end
desc "Remove all failed jobs"
task :remove_all do
set :resque_pre, "cd #{current_path} && RAILS_ENV=#{environment} bundle exec rails runner"
run "#{resque_pre} 'ResqueUtils::remove_all'"
end
desc "Requeue specific failed jobs (specify with '--set exception=SomeErrorHere)"
task :requeue_specific do
if exists?(:exception)
set :resque_pre, "cd #{current_path} && RAILS_ENV=#{environment} bundle exec rails runner"
run "#{resque_pre} \"ResqueUtils::requeue_specific('#{exception}')\""
else
raise ArgumentError, "No exception was specified, use '--set exception=SomeErrorHere'"
end
end
desc "Remove specific failed jobs (specify with '--set exception=SomeErrorHere)"
task :remove_specific do
if exists?(:exception)
set :resque_pre, "cd #{current_path} && RAILS_ENV=#{environment} bundle exec rails runner"
run "#{resque_pre} \"ResqueUtils::remove_specific('#{exception}')\""
else
raise ArgumentError, "No exception was specified, use '--set exception=SomeErrorHere'"
end
end
end
end
end