summaryrefslogtreecommitdiff
path: root/lib/rubygems.rb
diff options
context:
space:
mode:
authorryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-01-28 23:46:47 +0000
committerryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-01-28 23:46:47 +0000
commit934f537b458778f4786716c95b73fc72bc1ce256 (patch)
tree6abdecd9956995a7f82c9f969c80657b4301f6bd /lib/rubygems.rb
parentb511e1bfbe649b938e317e00ad1795f1b9623758 (diff)
Import rubygems 1.5.0 (release candidate @ 09893d9)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30717 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems.rb')
-rw-r--r--lib/rubygems.rb30
1 files changed, 21 insertions, 9 deletions
diff --git a/lib/rubygems.rb b/lib/rubygems.rb
index 08c675a86f..ddb4c2aaa4 100644
--- a/lib/rubygems.rb
+++ b/lib/rubygems.rb
@@ -1,3 +1,9 @@
+######################################################################
+# This file is imported from the rubygems project.
+# DO NOT make modifications in this repo. They _will_ be reverted!
+# File a patch instead and assign it to Ryan Davis or Eric Hodel.
+######################################################################
+
# -*- ruby -*-
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
@@ -5,15 +11,20 @@
# See LICENSE.txt for permissions.
#++
-# TODO: remove when 1.9.1 no longer supported
-QUICKLOADER_SUCKAGE = RUBY_VERSION >= "1.9.1" and RUBY_VERSION < "1.9.2"
-# TODO: remove when 1.9.2 no longer supported
-GEM_PRELUDE_SUCKAGE = RUBY_VERSION >= "1.9.2" and RUBY_VERSION < "1.9.3"
+module Gem
+ QUICKLOADER_SUCKAGE = RUBY_VERSION =~ /^1\.9\.1/
+ GEM_PRELUDE_SUCKAGE = RUBY_VERSION =~ /^1\.9\.2/
+end
-gem_preluded = GEM_PRELUDE_SUCKAGE and defined? Gem
+if Gem::GEM_PRELUDE_SUCKAGE and defined?(Gem::QuickLoader) then
+ Gem::QuickLoader.remove
-if GEM_PRELUDE_SUCKAGE and defined?(Gem::QuickLoader) then
- Gem::QuickLoader.load_full_rubygems_library
+ $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)
@@ -1165,7 +1176,7 @@ end
module Kernel
- remove_method :gem if respond_to? :gem # defined in gem_prelude.rb on 1.9
+ remove_method :gem if 'method' == defined? gem # from gem_prelude.rb on 1.9
##
# Use Kernel#gem to activate a specific version of +gem_name+.
@@ -1217,6 +1228,7 @@ end
require 'rubygems/exceptions'
+gem_preluded = Gem::GEM_PRELUDE_SUCKAGE and defined? Gem
unless gem_preluded then # TODO: remove guard after 1.9.2 dropped
begin
##
@@ -1240,7 +1252,7 @@ end
##
# Enables the require hook for RubyGems.
-require 'rubygems/custom_require'
+require 'rubygems/custom_require' unless Gem::GEM_PRELUDE_SUCKAGE
Gem.clear_paths