summaryrefslogtreecommitdiff
path: root/lib/rubygems.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-04-18 00:04:12 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-04-18 00:04:12 +0000
commit6c1da63bd77b4caa409b919f8c9893b27f9ae1be (patch)
treeaa2133f45cc00ba879f1309a0a890b15d10dd4c2 /lib/rubygems.rb
parent5ab11990cb24bc31c400b21a07b10c48d0b0d5d1 (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@35374 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems.rb')
-rw-r--r--lib/rubygems.rb81
1 files changed, 51 insertions, 30 deletions
diff --git a/lib/rubygems.rb b/lib/rubygems.rb
index c8f969224c..64bf3a2dd9 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
@@ -110,6 +112,7 @@ require "rubygems/deprecate"
# * Daniel Berger -- djberg96(at)gmail.com
# * Phil Hagelberg -- technomancy(at)gmail.com
# * Ryan Davis -- ryand-ruby(at)zenspider.com
+# * Evan Phoenix -- evan@phx.io
#
# (If your name is missing, PLEASE let us know!)
#
@@ -118,7 +121,7 @@ require "rubygems/deprecate"
# -The RubyGems Team
module Gem
- VERSION = '1.8.11'
+ VERSION = '1.8.22'
##
# Raised when RubyGems is unable to load or activate a gem. Contains the
@@ -256,7 +259,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 +445,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 +642,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 +1009,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
##