Skip to content
This repository has been archived by the owner on Jun 29, 2019. It is now read-only.

Commit

Permalink
why this can't be declared elsewhere confuses me
Browse files Browse the repository at this point in the history
  • Loading branch information
lloydpick committed Aug 17, 2011
1 parent f87f568 commit 9c8c878
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions lib/resque_utils/capistrano.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,40 @@

namespace :resque do

set :resque_pre, "cd #{current_path} && RAILS_ENV=#{environment} bundle exec rails runner"

namespace :failed do

desc "Requeue all failed jobs"
task :requeue_all do
set :resque_pre, "#{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, "#{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, "#{current_path} && RAILS_ENV=#{environment} bundle exec rails runner"
run "#{resque_pre} \"ResqueUtils::requeue_all('#{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, "#{current_path} && RAILS_ENV=#{environment} bundle exec rails runner"
run "#{resque_pre} \"ResqueUtils::remove_all('#{exception}')\""
else
raise ArgumentError, "No exception was specified, use '--set exception=SomeErrorHere'"
end
end

end
end

Expand Down

0 comments on commit 9c8c878

Please sign in to comment.