summaryrefslogtreecommitdiff
path: root/lib/rubygems.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-06-07 21:27:16 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-06-07 21:27:16 +0000
commit2b322524cdd0a5b6767eb72422cacc04b71902f2 (patch)
treedaf4c7bfef89cecedf5ae4ce4eb124a620697b4a /lib/rubygems.rb
parentc9331864f847a78550da88a780a5981bd283a6c7 (diff)
* gem_prelude.rb: load full rubygems at LoadError for activation
check. [ruby-core:29486] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28200 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems.rb')
-rw-r--r--lib/rubygems.rb25
1 files changed, 22 insertions, 3 deletions
diff --git a/lib/rubygems.rb b/lib/rubygems.rb
index d2e0f2cb5d..1dee815a15 100644
--- a/lib/rubygems.rb
+++ b/lib/rubygems.rb
@@ -1020,8 +1020,6 @@ end
module Kernel
- undef gem if respond_to? :gem # defined in gem_prelude.rb on 1.9
-
##
# Use Kernel#gem to activate a specific version of +gem_name+.
#
@@ -1098,13 +1096,34 @@ end
require 'rubygems/config_file'
+class << Gem
+ verbose, debug = $VERBOSE, $DEBUG
+ $VERBOSE = $DEBUG = nil
+
+ ##
+ #
+ # Called from the custom_require to attempt to activate +path+
+ # Internal use only.
+
+ def try_activate(path) # :doc:
+ spec = Gem.searcher.find(path)
+ return false unless spec
+
+ Gem.activate(spec.name, "= #{spec.version}")
+ return true
+ end
+
+ensure
+ $VERBOSE, $DEBUG = verbose, debug
+end
+
##
# Enables the require hook for RubyGems.
#
# Ruby 1.9 allows --disable-gems, so we require it when we didn't detect a Gem
# constant at rubygems.rb load time.
-require 'rubygems/custom_require' if gem_disabled or RUBY_VERSION < '1.9'
+require 'rubygems/custom_require'
Gem.clear_paths