sshingler/capistrano-resque — pull request #59 by billymonk (2013-09-27 02:25:40+00:00)
Title: Add ability to set rails_env.

Fall back on rails_env followed by "production" if capistrano_resque_rails_env is not set.

Inspiration came from a deploy.rb that sets its rails_env to an environment different than what is needed when running resque workers. I didn't like the following solution:

after "deploy:restart", "restart_resque"

desc "Restart Resque using capistrano-resque."
task "restart_resque" do
set :rails_env, "environment needed for resque"
resque.restart
set :rails_env, "previous environment"
end

If an alternative, simpler solution exists please let me know and I'll close the pull request.

Solution adapted from https://github.com/javan/whenever/blob/master/lib/whenever/capistrano/recipes.rb