Sha256: e737019c3804ce101f98231be8797f5ccdcc81f37d7ff6c78f72acdbfa423eb0

Contents?: true

Size: 1.4 KB

Versions: 11

Compression:

Stored size: 1.4 KB

Contents

require 'hoptoad_notifier'
require 'hoptoad_notifier/rails/controller_methods'
require 'hoptoad_notifier/rails/action_controller_catcher'
require 'hoptoad_notifier/rails/error_lookup'

module HoptoadNotifier
  module Rails
    def self.initialize
      if defined?(ActionController::Base)
        ActionController::Base.send(:include, HoptoadNotifier::Rails::ActionControllerCatcher)
        ActionController::Base.send(:include, HoptoadNotifier::Rails::ErrorLookup)
        ActionController::Base.send(:include, HoptoadNotifier::Rails::ControllerMethods)
      end

      rails_logger = if defined?(::Rails.logger)
                       ::Rails.logger
                     elsif defined?(RAILS_DEFAULT_LOGGER)
                       RAILS_DEFAULT_LOGGER
                     end

      if defined?(::Rails.configuration) && ::Rails.configuration.respond_to?(:middleware)
        ::Rails.configuration.middleware.insert_after 'ActionController::Failsafe',
                                                      HoptoadNotifier::Rack
      end

      HoptoadNotifier.configure(true) do |config|
        config.logger = rails_logger
        config.environment_name = RAILS_ENV  if defined?(RAILS_ENV)
        config.project_root     = RAILS_ROOT if defined?(RAILS_ROOT)
        config.framework        = "Rails: #{::Rails::VERSION::STRING}" if defined?(::Rails::VERSION)
      end
    end
  end
end

HoptoadNotifier::Rails.initialize

Version data entries

11 entries across 11 versions & 4 rubygems

Version Path
hoptoad_notifier-2.3.2 lib/hoptoad_notifier/rails.rb
jordan-brough-hoptoad_notifier-2.3.0 lib/hoptoad_notifier/rails.rb
hoptoad_notifier-2.3.0 lib/hoptoad_notifier/rails.rb
hatless-hoptoad_notifier-2.2.6.1 lib/hoptoad_notifier/rails.rb
hatless-hoptoad_notifier-2.2.6.001 lib/hoptoad_notifier/rails.rb
hatless-hoptoad_notifier-2.2.6 lib/hoptoad_notifier/rails.rb
hoptoad_notifier-2.2.6 lib/hoptoad_notifier/rails.rb
hoptoad_notifier-2.2.5 lib/hoptoad_notifier/rails.rb
hoptoad_notifier-2.2.2 lib/hoptoad_notifier/rails.rb
errornot_notifier-0.1.0 lib/hoptoad_notifier/rails.rb
hoptoad_notifier-2.2.0 lib/hoptoad_notifier/rails.rb