Sha256: ddf237a3403464fcaf9acce48fcec68e0351e72c276f99d04440439e54868815

Contents?: true

Size: 1.3 KB

Versions: 6

Compression:

Stored size: 1.3 KB

Contents

require "raygun/middleware/rails_insert_affected_user"

class Raygun::Railtie < Rails::Railtie
  initializer "raygun.configure_rails_initialization" do |app|

    # Thanks Airbrake: See https://github.com/rails/rails/pull/8624
    middleware = if defined?(ActionDispatch::DebugExceptions)
                   if Rails::VERSION::STRING >= "5"
                     ActionDispatch::DebugExceptions
                   else
                     # Rails >= 3.2.0
                     "ActionDispatch::DebugExceptions"
                   end
                 else
                   # Rails < 3.2.0
                   "ActionDispatch::ShowExceptions"
                 end

    raygun_middleware = [
      Raygun::Middleware::RailsInsertAffectedUser,
      Raygun::Middleware::RackExceptionInterceptor,
      Raygun::Middleware::BreadcrumbsStoreInitializer,
      Raygun::Middleware::JavascriptExceptionTracking
    ]
    raygun_middleware = raygun_middleware.map(&:to_s) unless Rails::VERSION::STRING >= "5"
    raygun_middleware.each do |m|
      app.config.middleware.insert_after(middleware, m)
    end
  end

  config.to_prepare do
    Raygun.default_configuration.logger           = Rails.logger
    Raygun.default_configuration.enable_reporting = Rails.env.production?
  end

  rake_tasks do
    load "tasks/raygun.tasks"
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
raygun4ruby-3.2.3 lib/raygun/railtie.rb
raygun4ruby-3.2.3.pre lib/raygun/railtie.rb
raygun4ruby-3.2.1 lib/raygun/railtie.rb
raygun4ruby-3.2.0 lib/raygun/railtie.rb
raygun4ruby-3.1.1 lib/raygun/railtie.rb
raygun4ruby-3.1.0 lib/raygun/railtie.rb