class NRBundlerPatcher

Constants

BUNDLER
RUBYOPT

Public Class Methods

check_for_bundler() click to toggle source
# File lib/boot/strap.rb, line 84
def self.check_for_bundler
  require_bundler

  raise 'Required Ruby Bundler class Bundler::Runtime not defined!' unless defined?(Bundler::Runtime)

  unless Bundler::Runtime.method_defined?(:require)
    raise "The active Ruby Bundler instance doesn't offer Bundler::Runtime#require"
  end
end
check_for_require() click to toggle source
# File lib/boot/strap.rb, line 74
def self.check_for_require
  raise "#{__FILE__} is meant to be required, not invoked directly" if $PROGRAM_NAME == __FILE__
end
check_for_rubyopt() click to toggle source
# File lib/boot/strap.rb, line 78
def self.check_for_rubyopt
  unless ENV[RUBYOPT].to_s.match?("-r #{__FILE__.rpartition('.').first}")
    raise "#{__FILE__} is meant to be required via the RUBYOPT env var"
  end
end
patch() click to toggle source
# File lib/boot/strap.rb, line 63
def self.patch
  check_for_require
  check_for_rubyopt
  check_for_bundler
  Bundler::Runtime.prepend(NRBundlerPatch)
rescue StandardError => e
  Kernel.warn "New Relic entrypoint at #{__FILE__} encountered an issue:\n  #{e.message}"
end
require_bundler() click to toggle source
# File lib/boot/strap.rb, line 94
def self.require_bundler
  require BUNDLER
rescue LoadError => e
  raise "Required Ruby library '#{BUNDLER}' could not be required - #{e}"
end