Sha256: d31f9e2d7392b08c769bb200d95b4f1d4864537c7d9a759a97000e5f46aab260

Contents?: true

Size: 1.77 KB

Versions: 2

Compression:

Stored size: 1.77 KB

Contents

require 'projectlocker_pulse'
require 'rails'

module Pulse
  class Railtie < ::Rails::Railtie
    rake_tasks do
      require 'pulse/rake_handler'
      require 'pulse/rails3_tasks'
      #load "#{File.dirname(__FILE__)}/rails3_tasks.rb"
    end

    initializer "pulse.use_rack_middleware" do |app|
      app.config.middleware.insert 0, "Pulse::UserInformer"
      app.config.middleware.insert_after "Pulse::UserInformer","Pulse::Rack"
    end

    config.after_initialize do
      Pulse.configure(true) do |config|
        config.logger           ||= config.async? ? ::Logger.new(STDERR) : ::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 'pulse/rails/javascript_notifier'
        require 'pulse/rails/controller_methods'

        include Pulse::Rails::JavascriptNotifier
        include Pulse::Rails::ControllerMethods
      end

      if defined?(::ActionDispatch::DebugExceptions)
        # We should catch the exceptions in ActionDispatch::DebugExceptions in Rails 3.2.x.
        #
        require 'pulse/rails/middleware/exceptions_catcher'
        ::ActionDispatch::DebugExceptions.send(:include,Pulse::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 'pulse/rails/middleware/exceptions_catcher'
        ::ActionDispatch::ShowExceptions.send(:include,Pulse::Rails::Middleware::ExceptionsCatcher)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
projectlocker_pulse-1.0.0 lib/pulse/railtie.rb
projectlocker_pulse-0.2.1 lib/pulse/railtie.rb