Sha256: 455cabb1caef1fff4f5182b06113e9136de85208cd55366382a3361629223507

Contents?: true

Size: 932 Bytes

Versions: 1

Compression:

Stored size: 932 Bytes

Contents

$stderr.puts 'loading roo_on_rails railtie'

module RooOnRails
  class Railtie < Rails::Railtie
    initializer 'roo_on_rails.default_env' do
      $stderr.puts 'initializer roo_on_rails.default_env'
      Dotenv.load File.expand_path('../default.env', __FILE__)
    end

    # initializer 'roo_on_rails.print_env' do
    #   ENV.to_a.sort.each do |k,v|
    #     puts "#{k}: #{v}"
    #   end
    # end

    initializer 'roo_on_rails.new_relic' do
      $stderr.puts 'initializer roo_on_rails.new_relic'

      unless ENV['NEW_RELIC_LICENSE_KEY']
        abort 'Aborting: NEW_RELIC_LICENSE_KEY is required'
      end

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

      require 'newrelic_rpm'
      ::NewRelic::Agent.manual_start
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
roo_on_rails-1.0.0 lib/roo_on_rails/railtie.rb