summaryrefslogtreecommitdiff
path: root/lib/rubygems
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
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')
-rw-r--r--lib/rubygems/custom_require.rb17
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/rubygems/custom_require.rb b/lib/rubygems/custom_require.rb
index 43b3136b60..36e3c78911 100644
--- a/lib/rubygems/custom_require.rb
+++ b/lib/rubygems/custom_require.rb
@@ -4,8 +4,6 @@
# See LICENSE.txt for permissions.
#++
-require 'rubygems'
-
module Kernel
##
@@ -31,10 +29,17 @@ module Kernel
gem_original_require path
rescue LoadError => load_error
if load_error.message.end_with?(path) and
- spec = Gem.searcher.find(path) then
- Gem.activate(spec.name, "= #{spec.version}")
- gem_original_require path
+ begin
+ Gem.try_activate(path)
+ rescue Gem::LoadError => load_error
+ pat = "#{__FILE__}:#{__LINE__-2}:in "
+ bt = load_error.backtrace
+ num = bt.index {|e| e.start_with?(pat)} and bt.shift(num+2)
+ raise load_error
+ end
+ retry
else
+ load_error.backtrace.shift(2)
raise load_error
end
end
@@ -42,5 +47,5 @@ module Kernel
private :require
private :gem_original_require
-end
+end unless Kernel.private_method_defined?(:gem_original_require)