I started a new Rails 4 app and realised the generator was creating RAILS_ROOT/script/delayed_job. This directory has been replaced in Rails 4 with RAILS_ROOT/bin and binstubs. I'm using this binstub in production.
I noticed there are no tests for the generators. I've tested it locally with a brand new Rails 4 app.
I'm also happy to write a new rake task for upgrading from DJ 3 to DJ 4.
We will not be throwing out support for Rails 3 until at least 3.2's EOL, so this pull request would need to support Rails 3 as well before it could be accepted.
Generate delayed_job executable based on ActiveSupport version.
* Rails 4 compatibility.
* Refactored version switching into Delayed::Compatibility.
Thanks for the quick response.
I've changed it so that script/delayed_job is generated for Rails 3 and bin/delayed_job is generated for Rails 4. The README still references bin. I figure it would be worth adding a note about script for Rails 3.
I noticed that switching on the rails version would be happening in lib/delayed/message_sending.rb and lib/generators/delayed_job/delayed_job_generator.rb and created Delayed::Compatibility to centralise switching.
Interested to know your thoughts.
I've got simpler code for this task: #520
The difference between #520 and this pull request is Delayed:: Compatibility. I noticed there was a pattern emerging for switching on rails versioning and centralised it into a single module. I hope the maintainers see the same value in this as I do.
Closed by 6192b6c and a0b0ac8