Sha256: f25073be5116f34822b77426f43001cc215751e35c0d6c577e439ea992fe142e

Contents?: true

Size: 1.14 KB

Versions: 1

Compression:

Stored size: 1.14 KB

Contents

# encoding: utf-8

module HireFire
  class Railtie < Rails::Railtie

    ##
    # Initializes HireFire for either Delayed Job or Resque when
    # the Ruby on Rails web framework is done loading
    #
    # @note
    #   Either the Delayed Job, or the Resque worker library must be
    #   loaded BEFORE HireFire initializes, otherwise it'll be unable
    #   to detect the proper library and it will not work.
    initializer :after_initialize do
      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

      ##
      # If Resque is loaded, then we load the Resque rake task
      # that'll allow Heroku to start up Resque as a worker
      if defined?(::Resque)
        require 'hirefire/workers/resque/tasks'
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hirefire-0.1.4 lib/hirefire/railtie.rb