Sha256: ca902d87d1a7381d7cb6be0a42d5b18ef425da9673ed001d3618405f8ef6b4cc

Contents?: true

Size: 1.16 KB

Versions: 4

Compression:

Stored size: 1.16 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 File.join(WORKERS_PATH, 'resque', 'tasks.rb')
      end
    end

  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
hirefire-0.1.3 lib/hirefire/railtie.rb
hirefire-0.1.2 lib/hirefire/railtie.rb
samoli-hirefire-0.1.1 lib/hirefire/railtie.rb
hirefire-0.1.1 lib/hirefire/railtie.rb