Sha256: 052559a0ea3cb31d02c5972a46ac428bee9631cab446ff0ccb6e9098233847b3

Contents?: true

Size: 1.58 KB

Versions: 32

Compression:

Stored size: 1.58 KB

Contents

# :stopdoc:

#--
# This file contains all sorts of little compatibility hacks that we've
# had to introduce over the years. Quarantining them into one file helps
# us know when we can get rid of them.
#
# Ruby 1.9.x has introduced some things that are awkward, and we need to
# support them, so we define some constants to use later.
#++
module Gem
  # Only MRI 1.9.2 has the custom prelude.
  GEM_PRELUDE_SUCKAGE = RUBY_VERSION =~ /^1\.9\.2/ and RUBY_ENGINE == "ruby"
end

# Gem::QuickLoader exists in the gem prelude code in ruby 1.9.2 itself.
# We gotta get rid of it if it's there, before we do anything else.
if Gem::GEM_PRELUDE_SUCKAGE and defined?(Gem::QuickLoader) then
  Gem::QuickLoader.remove

  $LOADED_FEATURES.delete Gem::QuickLoader.path_to_full_rubygems_library

  if $LOADED_FEATURES.any? do |path| path.end_with? '/rubygems.rb' end then
    # TODO path does not exist here
    raise LoadError, "another rubygems is already loaded from #{path}"
  end

  class << Gem
    remove_method :try_activate if Gem.respond_to?(:try_activate, true)
  end
end

module Gem
  RubyGemsVersion = VERSION

  RbConfigPriorities = %w[
    EXEEXT RUBY_SO_NAME arch bindir datadir libdir ruby_install_name
    ruby_version rubylibprefix sitedir sitelibdir vendordir vendorlibdir
    rubylibdir
  ]

  unless defined?(ConfigMap)
    ##
    # Configuration settings from ::RbConfig
    ConfigMap = Hash.new do |cm, key|
      cm[key] = RbConfig::CONFIG[key.to_s]
    end
  else
    RbConfigPriorities.each do |key|
      ConfigMap[key.to_sym] = RbConfig::CONFIG[key]
    end
  end

  RubyGemsPackageVersion = VERSION
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
rubygems-update-2.0.17 lib/rubygems/compatibility.rb
rubygems-update-2.0.16 lib/rubygems/compatibility.rb
rubygems-update-2.0.15 lib/rubygems/compatibility.rb
rubygems-update-2.1.11 lib/rubygems/compatibility.rb
rubygems-update-2.0.14 lib/rubygems/compatibility.rb
rubygems-update-2.1.10 lib/rubygems/compatibility.rb
rubygems-update-2.0.13 lib/rubygems/compatibility.rb
rubygems-update-2.0.12 lib/rubygems/compatibility.rb
rubygems-update-2.1.9 lib/rubygems/compatibility.rb
rubygems-update-2.1.8 lib/rubygems/compatibility.rb
rubygems-update-2.1.7 lib/rubygems/compatibility.rb
rubygems-update-2.0.11 lib/rubygems/compatibility.rb
rubygems-update-2.1.6 lib/rubygems/compatibility.rb
rubygems-update-2.0.10 lib/rubygems/compatibility.rb
rubygems-update-2.1.5 lib/rubygems/compatibility.rb
rubygems-update-2.1.4 lib/rubygems/compatibility.rb
rubygems-update-2.0.9 lib/rubygems/compatibility.rb
rubygems-update-2.1.3 lib/rubygems/compatibility.rb
rubygems-update-2.1.2 lib/rubygems/compatibility.rb
rubygems-update-2.1.1 lib/rubygems/compatibility.rb