Sha256: a455b3430959e4f19dea2ca1c63e1144ebd4e1f87f2348d2063b7cb303035e1a

Contents?: true

Size: 1.82 KB

Versions: 10

Compression:

Stored size: 1.82 KB

Contents

require 'honeybadger'
require 'honeybadger/monitor'
require 'rails'

module Honeybadger
  class Railtie < Rails::Railtie
    rake_tasks do
      require 'honeybadger/rake_handler'
      require "honeybadger/rails3_tasks"
    end

    initializer "honeybadger.use_rack_middleware" do |app|
      app.config.middleware.insert 0, "Honeybadger::UserInformer"
      app.config.middleware.insert_after "Honeybadger::UserInformer","Honeybadger::UserFeedback"
      app.config.middleware.insert_after "Honeybadger::UserFeedback","Honeybadger::Rack"
    end

    config.after_initialize do
      Honeybadger.configure(true) do |config|
        config.logger           ||= ::Rails.logger
        config.environment_name ||= ::Rails.env
        config.project_root     ||= ::Rails.root
        config.framework        = "Rails: #{::Rails::VERSION::STRING}"
      end

      ActiveSupport.on_load(:action_controller) do
        # Lazily load action_controller methods
        #
        require 'honeybadger/rails/controller_methods'

        include Honeybadger::Rails::ControllerMethods
      end

      if defined?(::ActionDispatch::DebugExceptions)
        # We should catch the exceptions in ActionDispatch::DebugExceptions in Rails 3.2.x.
        #
        require 'honeybadger/rails/middleware/exceptions_catcher'
        ::ActionDispatch::DebugExceptions.send(:include,Honeybadger::Rails::Middleware::ExceptionsCatcher)
      elsif defined?(::ActionDispatch::ShowExceptions)
        # ActionDispatch::DebugExceptions is not defined in Rails 3.0.x and 3.1.x so
        # catch the exceptions in ShowExceptions.
        #
        require 'honeybadger/rails/middleware/exceptions_catcher'
        ::ActionDispatch::ShowExceptions.send(:include,Honeybadger::Rails::Middleware::ExceptionsCatcher)
      end

      Honeybadger.ping(Honeybadger.configuration)
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
honeybadger-1.13.2 lib/honeybadger/railtie.rb
honeybadger-1.13.1 lib/honeybadger/railtie.rb
honeybadger-1.13.0 lib/honeybadger/railtie.rb
honeybadger-1.11.2 lib/honeybadger/railtie.rb
honeybadger-1.11.1 lib/honeybadger/railtie.rb
honeybadger-1.11.0 lib/honeybadger/railtie.rb
honeybadger-1.11.0.beta4 lib/honeybadger/railtie.rb
honeybadger-1.11.0.beta3 lib/honeybadger/railtie.rb
honeybadger-1.11.0.beta2 lib/honeybadger/railtie.rb
honeybadger-1.11.0.beta1 lib/honeybadger/railtie.rb