Sha256: 36a1f77b0a55c249e11b683977ab735394144a5f949ad8dca0118e1a31c5483c

Contents?: true

Size: 1.69 KB

Versions: 10

Compression:

Stored size: 1.69 KB

Contents

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

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)
        ActionController::Base.send(:include, HoptoadNotifier::Rails::JavascriptNotifier)
      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
        ::Rails.configuration.middleware.insert_after 'Rack::Lock',
                                                      HoptoadNotifier::UserInformer
      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

10 entries across 10 versions & 2 rubygems

Version Path
square-hoptoad_notifier-2.4.9 lib/hoptoad_notifier/rails.rb
hoptoad_notifier-2.4.11 lib/hoptoad_notifier/rails.rb
hoptoad_notifier-2.4.10 lib/hoptoad_notifier/rails.rb
hoptoad_notifier-2.4.9 lib/hoptoad_notifier/rails.rb
square-hoptoad_notifier-2.4.8 lib/hoptoad_notifier/rails.rb
hoptoad_notifier-2.4.8 lib/hoptoad_notifier/rails.rb
hoptoad_notifier-2.4.7 lib/hoptoad_notifier/rails.rb
hoptoad_notifier-2.4.6 lib/hoptoad_notifier/rails.rb
hoptoad_notifier-2.4.5 lib/hoptoad_notifier/rails.rb
hoptoad_notifier-2.4.4 lib/hoptoad_notifier/rails.rb