diff --git a/lib/hirefire/railtie.rb b/lib/hirefire/railtie.rb index b251293..d922715 100644 --- a/lib/hirefire/railtie.rb +++ b/lib/hirefire/railtie.rb @@ -15,5 +15,20 @@ class Railtie < Rails::Railtie HireFire::Initializer.initialize! end + ## + # Adds additional rake tasks to the Ruby on Rails environment + # + # @note + # In order for Resque to run on Heroku, it must have the 'rake jobs:work' + # rake task since that's what Heroku uses to start workers. When using + # Ruby on Rails automatically add the necessary default rake task for the user + # + # @note + # Delayed Job already has 'rake jobs:work' built in. + # + rake_tasks do + require File.join(WORKERS_PATH, 'resque', 'tasks') + end + end end diff --git a/lib/hirefire/workers/resque/tasks.rb b/lib/hirefire/workers/resque/tasks.rb new file mode 100644 index 0000000..7335ddf --- /dev/null +++ b/lib/hirefire/workers/resque/tasks.rb @@ -0,0 +1,10 @@ +# encoding: utf-8 + +require 'resque/tasks' + +task 'resque:setup' => :environment do + ENV['QUEUE'] ||= '*' +end + +desc 'Alias for the rake task "resque:work", this is required for Heroku.' +task 'jobs:work' => 'resque:work'