summaryrefslogtreecommitdiff
path: root/lib/rubygems.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-04-17 20:50:00 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-04-17 20:50:00 +0000
commit22d9456b7917fe96fa81fd1d994073312753af8b (patch)
treebe157928ed84f75988ceb82a070797c3482b66a6 /lib/rubygems.rb
parent22263729af357eb86e8bc2165a9eaa6f25eec8a6 (diff)
* lib/rubygems: Update to RubyGems 1.8.22 plus r33517 and r35337 which
were ported to the rubygems git repository. See https://github.com/rubygems/rubygems/blob/1.8/History.txt for changes since 1.8.11. * test/rubygems: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35370 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems.rb')
-rw-r--r--lib/rubygems.rb80
1 files changed, 50 insertions, 30 deletions
diff --git a/lib/rubygems.rb b/lib/rubygems.rb
index c8f969224c..6c974fbc3d 100644
--- a/lib/rubygems.rb
+++ b/lib/rubygems.rb
@@ -7,7 +7,9 @@
module Gem
QUICKLOADER_SUCKAGE = RUBY_VERSION =~ /^1\.9\.1/
- GEM_PRELUDE_SUCKAGE = RUBY_VERSION =~ /^1\.9\.2/
+
+ # Only MRI 1.9.2 has the custom prelude.
+ GEM_PRELUDE_SUCKAGE = RUBY_VERSION =~ /^1\.9\.2/ && RUBY_ENGINE == "ruby"
end
if Gem::GEM_PRELUDE_SUCKAGE and defined?(Gem::QuickLoader) then
@@ -118,7 +120,7 @@ require "rubygems/deprecate"
# -The RubyGems Team
module Gem
- VERSION = '1.8.11'
+ VERSION = '1.8.21'
##
# Raised when RubyGems is unable to load or activate a gem. Contains the
@@ -256,7 +258,7 @@ module Gem
Gem.path.each do |gemdir|
each_load_path all_partials(gemdir) do |load_path|
- result << gemdir.add(load_path).expand_path
+ result << load_path
end
end
@@ -442,10 +444,10 @@ module Gem
# problem, then we will silently continue.
def self.ensure_gem_subdirectories dir = Gem.dir
- require 'fileutils'
-
old_umask = File.umask
- File.umask old_umask | 022
+ File.umask old_umask | 002
+
+ require 'fileutils'
%w[cache doc gems specifications].each do |name|
subdir = File.join dir, name
@@ -639,35 +641,54 @@ module Gem
index
end
+ @yaml_loaded = false
+
##
# Loads YAML, preferring Psych
def self.load_yaml
- begin
- gem 'psych', '~> 1.2', '>= 1.2.1' unless ENV['TEST_SYCK']
- rescue Gem::LoadError
- # It's OK if the user does not have the psych gem installed. We will
- # attempt to require the stdlib version
- end
+ return if @yaml_loaded
- begin
- # Try requiring the gem version *or* stdlib version of psych.
- require 'psych' unless ENV['TEST_SYCK']
- rescue ::LoadError
- ensure
- require 'yaml'
- end
+ test_syck = ENV['TEST_SYCK']
- # Hack to handle syck's DefaultKey bug with psych.
- # See the note at the top of lib/rubygems/requirement.rb for
- # why we end up defining DefaultKey more than once.
- if !defined? YAML::Syck
- YAML.module_eval do
- const_set 'Syck', Module.new {
- const_set 'DefaultKey', Class.new
- }
+ unless test_syck
+ begin
+ gem 'psych', '~> 1.2', '>= 1.2.1'
+ rescue Gem::LoadError
+ # It's OK if the user does not have the psych gem installed. We will
+ # attempt to require the stdlib version
+ end
+
+ begin
+ # Try requiring the gem version *or* stdlib version of psych.
+ require 'psych'
+ rescue ::LoadError
+ # If we can't load psych, thats fine, go on.
+ else
+ # If 'yaml' has already been required, then we have to
+ # be sure to switch it over to the newly loaded psych.
+ if defined?(YAML::ENGINE) && YAML::ENGINE.yamler != "psych"
+ YAML::ENGINE.yamler = "psych"
end
+
+ require 'rubygems/psych_additions'
+ require 'rubygems/psych_tree'
+ end
end
+
+ require 'yaml'
+
+ # If we're supposed to be using syck, then we may have to force
+ # activate it via the YAML::ENGINE API.
+ if test_syck and defined?(YAML::ENGINE)
+ YAML::ENGINE.yamler = "syck" unless YAML::ENGINE.syck?
+ end
+
+ # Now that we're sure some kind of yaml library is loaded, pull
+ # in our hack to deal with Syck's DefaultKey ugliness.
+ require 'rubygems/syck_hack'
+
+ @yaml_loaded = true
end
##
@@ -987,9 +1008,8 @@ module Gem
def self.loaded_path? path
# TODO: ruby needs a feature to let us query what's loaded in 1.8 and 1.9
- $LOADED_FEATURES.find { |s|
- s =~ /(^|\/)#{Regexp.escape path}#{Regexp.union(*Gem.suffixes)}$/
- }
+ re = /(^|\/)#{Regexp.escape path}#{Regexp.union(*Gem.suffixes)}$/
+ $LOADED_FEATURES.any? { |s| s =~ re }
end
##