Sha256: 64cec673d1f5791abd65380c4ec3b1ea5f79404789611fdd3cbf98a9bd0ead9f

Contents?: true

Size: 1.09 KB

Versions: 3

Compression:

Stored size: 1.09 KB

Contents

# A control used when no framework is detected.
# Looks for a newrelic.yml file in several locations
# including ./, ./config, $HOME/.newrelic and $HOME/.
# It loads the settings from the newrelic.yml section
# based on the value of RUBY_ENV or RAILS_ENV. 
class NewRelic::Control::Frameworks::Ruby < NewRelic::Control
  
  def env
    @env ||= ENV['RUBY_ENV'] || ENV['RAILS_ENV'] || ENV['RACK_ENV'] || 'development'
  end
  def root
    @root ||= ENV['APP_ROOT'] || Dir['.']
  end
  # Check a sequence of file locations for newrelic.yml
  def config_file
    files = []
    files << File.join(root,"config","newrelic.yml")
    files << File.join(root,"newrelic.yml")
    if ENV["HOME"]
      files << File.join(ENV["HOME"], ".newrelic", "newrelic.yml") 
      files << File.join(ENV["HOME"], "newrelic.yml")
    end
    files << File.expand_path(ENV["NRCONFIG"]) if ENV["NRCONFIG"]
    files.each do | file |
      return File.expand_path(file) if File.exists? file
    end
    return File.expand_path(files.first)
  end
  def to_stdout(msg)
    STDOUT.puts msg
  end
  
  def init_config(options={})
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
newrelic_rpm-2.13.0.beta5 lib/new_relic/control/frameworks/ruby.rb
newrelic_rpm-2.13.0.beta4 lib/new_relic/control/frameworks/ruby.rb
newrelic_rpm-2.13.0.beta3 lib/new_relic/control/frameworks/ruby.rb