sshingler/capistrano-resque — pull request #62 by dmarkow (2013-10-19 02:36:11+00:00)
Title: Capistrano V3 Support

This is a first attempt at getting support working for Capistrano V3 __while maintaining support for V2.__ (So there shouldn't be a need to release separate versioned gems).

* V3 loads tasks differently, so a new `capistrano-resque.rake` file needed to be added using V3's new DSL. The `capistrano-resque.rb` file now examines the Capistrano version and chooses what to load based on that.
* I tried to stick to V3's DSL as much as possible (e.g. using `execute :rake, "..."` instead of passing a raw command string to `run()`), as this will allow proper compatibility with rbenv, bundler, etc.
* Since Capistrano now automatically prepends `bundle exec` to any commands if you tell it to use bundler in your `Capfile`, there was no need to explicitly use bundler in the new tasks.
* The duplicative `on roles(role) do` blocks in the `:start` task appear to be necessary. An `on` block needs to be used near the beginning of the method to allow access to the `info` method, but if you don't include an additional `on` block within the thread creation block, the threads fail to execute properly when there are multiple workers.

I'm using this on my production apps and it's stopping/starting/restarting my workers perfectly. However, I'm not using any complicated roles and I'm not using resque-scheduler, so that hasn't specifically been tested.