mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 08:33:58 +02:00
Pull rubygem's custom require into gem_prelude
This solves the gem loading issue by never touching $LOAD_PATH in gem_prelude and instead loading all of rubygems more quickly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28693 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b117475e18
commit
bb43e6892c
5 changed files with 40 additions and 111 deletions
|
@ -4,8 +4,6 @@
|
|||
# See LICENSE.txt for permissions.
|
||||
#++
|
||||
|
||||
require 'rubygems'
|
||||
|
||||
module Kernel
|
||||
|
||||
##
|
||||
|
@ -30,17 +28,15 @@ module Kernel
|
|||
def require(path) # :doc:
|
||||
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
|
||||
else
|
||||
raise load_error
|
||||
if load_error.message.end_with?(path)
|
||||
return true if Gem.try_activate(path)
|
||||
end
|
||||
|
||||
raise load_error
|
||||
end
|
||||
|
||||
private :require
|
||||
private :gem_original_require
|
||||
|
||||
end
|
||||
end unless Kernel.private_method_defined?(:gem_original_require)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue