mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Fix RubyGems for 1.9, r1780
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17393 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9d4f37f51f
commit
215fbc639f
10 changed files with 86 additions and 90 deletions
120
gem_prelude.rb
120
gem_prelude.rb
|
@ -1,9 +1,5 @@
|
|||
# depends on: array.rb dir.rb env.rb file.rb hash.rb module.rb regexp.rb
|
||||
|
||||
# empty gem_prelude.rb
|
||||
#
|
||||
# p defined?(Gem)
|
||||
|
||||
if defined?(Gem) then
|
||||
|
||||
module Kernel
|
||||
|
@ -28,73 +24,69 @@ if defined?(Gem) then
|
|||
:ruby_install_name => RbConfig::CONFIG["ruby_install_name"]
|
||||
}
|
||||
|
||||
class << self
|
||||
|
||||
def default_dir
|
||||
if defined? RUBY_FRAMEWORK_VERSION
|
||||
return File.join(File.dirname(ConfigMap[:sitedir]), "Gems")
|
||||
else
|
||||
File.join(ConfigMap[:libdir], 'ruby', 'gems', ConfigMap[:ruby_version])
|
||||
end
|
||||
def self.default_dir
|
||||
if defined? RUBY_FRAMEWORK_VERSION
|
||||
return File.join(File.dirname(ConfigMap[:sitedir]), "Gems")
|
||||
else
|
||||
File.join(ConfigMap[:libdir], 'ruby', 'gems', ConfigMap[:ruby_version])
|
||||
end
|
||||
|
||||
def dir
|
||||
@gem_home ||= nil
|
||||
set_home(ENV['GEM_HOME'] || default_dir) unless @gem_home
|
||||
@gem_home
|
||||
end
|
||||
|
||||
def path
|
||||
@gem_path ||= nil
|
||||
unless @gem_path
|
||||
paths = [ENV['GEM_PATH']]
|
||||
paths << APPLE_GEM_HOME if defined? APPLE_GEM_HOME
|
||||
set_paths(paths.compact.join(File::PATH_SEPARATOR))
|
||||
end
|
||||
@gem_path
|
||||
end
|
||||
|
||||
# Set the Gem home directory (as reported by +dir+).
|
||||
def set_home(home)
|
||||
@gem_home = home
|
||||
ensure_gem_subdirectories(@gem_home)
|
||||
end
|
||||
|
||||
def set_paths(gpaths)
|
||||
if gpaths
|
||||
@gem_path = gpaths.split(File::PATH_SEPARATOR)
|
||||
@gem_path << Gem.dir
|
||||
else
|
||||
@gem_path = [Gem.dir]
|
||||
end
|
||||
@gem_path.uniq!
|
||||
@gem_path.each do |gp| ensure_gem_subdirectories(gp) end
|
||||
end
|
||||
|
||||
def ensure_gem_subdirectories(path)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def self.dir
|
||||
@gem_home ||= nil
|
||||
set_home(ENV['GEM_HOME'] || default_dir) unless @gem_home
|
||||
@gem_home
|
||||
end
|
||||
|
||||
def self.path
|
||||
@gem_path ||= nil
|
||||
unless @gem_path
|
||||
paths = [ENV['GEM_PATH']]
|
||||
paths << APPLE_GEM_HOME if defined? APPLE_GEM_HOME
|
||||
set_paths(paths.compact.join(File::PATH_SEPARATOR))
|
||||
end
|
||||
@gem_path
|
||||
end
|
||||
|
||||
# Set the Gem home directory (as reported by +dir+).
|
||||
def self.set_home(home)
|
||||
@gem_home = home
|
||||
ensure_gem_subdirectories(@gem_home)
|
||||
end
|
||||
|
||||
def self.set_paths(gpaths)
|
||||
if gpaths
|
||||
@gem_path = gpaths.split(File::PATH_SEPARATOR)
|
||||
@gem_path << Gem.dir
|
||||
else
|
||||
@gem_path = [Gem.dir]
|
||||
end
|
||||
@gem_path.uniq!
|
||||
@gem_path.each do |gp| ensure_gem_subdirectories(gp) end
|
||||
end
|
||||
|
||||
def self.ensure_gem_subdirectories(path)
|
||||
end
|
||||
|
||||
GEM_PRELUDE_METHODS = Gem.methods(false)
|
||||
|
||||
module QuickLoader
|
||||
|
||||
class << self
|
||||
def load_full_rubygems_library
|
||||
class << Gem
|
||||
Gem.methods(false).each do |method_name|
|
||||
undef_method method_name
|
||||
end
|
||||
def self.load_full_rubygems_library
|
||||
class << Gem
|
||||
Gem::GEM_PRELUDE_METHODS.each do |method_name|
|
||||
undef_method method_name
|
||||
end
|
||||
|
||||
Kernel.module_eval do
|
||||
undef_method :gem if method_defined? :gem
|
||||
end
|
||||
|
||||
$".delete File.join(Gem::ConfigMap[:libdir], 'ruby',
|
||||
Gem::ConfigMap[:ruby_version], 'rubygems.rb')
|
||||
|
||||
require 'rubygems'
|
||||
end
|
||||
|
||||
Kernel.module_eval do
|
||||
undef_method :gem if method_defined? :gem
|
||||
end
|
||||
|
||||
$".delete File.join(Gem::ConfigMap[:libdir], 'ruby',
|
||||
Gem::ConfigMap[:ruby_version], 'rubygems.rb')
|
||||
|
||||
require 'rubygems'
|
||||
end
|
||||
|
||||
GemPaths = {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue