Sha256: 1e84f03bee39d22068c79c1dd3a03493e8151d1057e185c24ae44d9202343a92

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

# frozen_string_literal: true

require 'rails/engine'

module Traxor
  module Rails
    class Engine < ::Rails::Engine
      initializer 'traxor.setup' do |app|
        if ::Rails.env.development? || ::Rails.env.test?
          Traxor.initialize_logger(::Rails.root.join('log', 'traxor.log'))
        end

        require 'traxor/rack'
        app.config.middleware.insert 0, Traxor::Rack::Middleware::Pre
        app.config.middleware.use Traxor::Rack::Middleware::Post

        ActiveSupport.on_load :action_controller do
          require 'traxor/rails/action_controller'
        end
        ActiveSupport.on_load :active_record do
          require 'traxor/rails/active_record'
        end
        ActiveSupport.on_load :action_mailer do
          require 'traxor/rails/action_mailer'
        end
      end

      config.before_configuration do
        require 'traxor/faraday' if defined?(Faraday)

        if defined?(Sidekiq)
          require 'traxor/sidekiq'
          ::Sidekiq.server_middleware do |chain|
            chain.add Traxor::Sidekiq
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
traxor-0.1.18 lib/traxor/rails/engine.rb