2015-12-16 08:07:31 +03:00
|
|
|
# frozen_string_literal: false
|
2013-01-25 05:04:18 +04:00
|
|
|
# :stopdoc:
|
|
|
|
|
2013-02-06 00:52:28 +04:00
|
|
|
#--
|
2012-11-29 10:52:18 +04:00
|
|
|
# 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.
|
2013-02-06 01:06:14 +04:00
|
|
|
#
|
2012-11-29 10:52:18 +04:00
|
|
|
# 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.
|
2013-02-06 00:52:28 +04:00
|
|
|
#++
|
2012-11-29 10:52:18 +04:00
|
|
|
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
|
|
|
|
|
2014-12-25 06:37:54 +03:00
|
|
|
if path = $LOADED_FEATURES.find {|n| n.end_with? '/rubygems.rb'} then
|
2012-11-29 10:52:18 +04:00
|
|
|
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
|
|
|
|
|
2014-01-07 05:19:28 +04:00
|
|
|
# TODO remove at RubyGems 3
|
|
|
|
|
2012-11-29 10:52:18 +04:00
|
|
|
RbConfigPriorities = %w[
|
2013-10-16 04:14:16 +04:00
|
|
|
MAJOR
|
|
|
|
MINOR
|
|
|
|
TEENY
|
2012-11-29 10:52:18 +04:00
|
|
|
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
|
2014-01-07 05:19:28 +04:00
|
|
|
ConfigMap = Hash.new do |cm, key| # TODO remove at RubyGems 3
|
2012-11-29 10:52:18 +04:00
|
|
|
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
|