class Puppet::Util::RubyGems::Source

Base/factory class for rubygems source. These classes introspec into rubygems to in order to list where the rubygems system will look for files to load.

Public Class Methods

has_rubygems?() click to toggle source

@api private

# File lib/puppet/util/rubygems.rb, line 11
def has_rubygems?
  # Gems are not actually available when Bundler is loaded, even
  # though the Gem constant is defined. This is because Bundler
  # loads in rubygems, but then removes the custom require that
  # rubygems installs. So when Bundler is around we have to act
  # as though rubygems is not, e.g. we shouldn't be able to load
  # a gem that Bundler doesn't want us to see.
  defined? ::Gem and not defined? ::Bundler
end
new(*args) click to toggle source
# File lib/puppet/util/rubygems.rb, line 30
def new(*args)
  object = source.allocate
  object.send(:initialize, *args)
  object
end
source() click to toggle source

@api private

# File lib/puppet/util/rubygems.rb, line 22
def source
  if has_rubygems?
    Gem::Specification.respond_to?(:latest_specs) ? Gems18Source : OldGemsSource
  else
    NoGemsSource
  end
end