Replace script/delayed_job with bin/delayed_job for Rails 4 compatbility #501

Closed
wants to merge 1 commit into from

3 participants

@tatey

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.

@albus522
Collective Idea member

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.

@tatey tatey Generate delayed_job executable based on ActiveSupport version.
* Rails 4 compatibility.
* Refactored version switching into Delayed::Compatibility.
2cd14ed
@tatey

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.

@semenyukdmitriy

I've got simpler code for this task: #520

@tatey

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.

@albus522
Collective Idea member

Closed by 6192b6c and a0b0ac8

@albus522 albus522 closed this May 21, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment