Sha256: c6aa86c02c0334335a13468887ab72cc59e5592238a53a1b1bab89ca923ae73f

Contents?: true

Size: 866 Bytes

Versions: 11

Compression:

Stored size: 866 Bytes

Contents

module RooOnRails
  module Railties
    class NewRelic < Rails::Railtie
      initializer 'roo_on_rails.new_relic' do
        $stderr.puts 'initializer roo_on_rails.new_relic'

        license_key = ENV['NEW_RELIC_LICENSE_KEY']

        if %w(test development).exclude?(Rails.env.to_s) && (license_key == 'override-me')
          abort 'Aborting: NEW_RELIC_LICENSE_KEY must be set in production environments'
        end

        abort 'Aborting: NEW_RELIC_LICENSE_KEY is required' if license_key.nil?

        path = %w(newrelic.yml config/newrelic.yml).map do |p|
          Pathname.new(p)
        end.find(&:exist?)
        if path
          abort "Aborting: newrelic.yml detected in '#{path.parent.realpath}', should not exist"
        end

        require 'newrelic_rpm'
        ::NewRelic::Agent.manual_start unless Rails.env.test?
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
roo_on_rails-1.10.0 lib/roo_on_rails/railties/new_relic.rb
roo_on_rails-1.9.0 lib/roo_on_rails/railties/new_relic.rb
roo_on_rails-1.8.1 lib/roo_on_rails/railties/new_relic.rb
roo_on_rails-1.8.0 lib/roo_on_rails/railties/new_relic.rb
roo_on_rails-1.7.0 lib/roo_on_rails/railties/new_relic.rb
roo_on_rails-1.6.0 lib/roo_on_rails/railties/new_relic.rb
roo_on_rails-1.5.0 lib/roo_on_rails/railties/new_relic.rb
roo_on_rails-1.4.0 lib/roo_on_rails/railties/new_relic.rb
roo_on_rails-1.3.1 lib/roo_on_rails/railties/new_relic.rb
roo_on_rails-1.3.0 lib/roo_on_rails/railties/new_relic.rb
roo_on_rails-1.2.0 lib/roo_on_rails/railties/new_relic.rb