summaryrefslogtreecommitdiff
path: root/gem_prelude.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-17 23:59:31 (GMT)
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-17 23:59:31 (GMT)
commit215fbc639fc63d4300a91ae4c8e30865f6a03f3c (patch)
tree13f0bc33bcdd0dca931c0af17a6ac1b70dd282f8 /gem_prelude.rb
parent9d4f37f51fb2ffdef5e318afb3cb81516dcba4f7 (diff)
Fix RubyGems for 1.9, r1780
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17393 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'gem_prelude.rb')
-rw-r--r--gem_prelude.rb102
1 files changed, 47 insertions, 55 deletions
diff --git a/gem_prelude.rb b/gem_prelude.rb
index ec9f1f4..28bbd83 100644
--- a/gem_prelude.rb
+++ b/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
- end
-
- def dir
- @gem_home ||= nil
- set_home(ENV['GEM_HOME'] || default_dir) unless @gem_home
- @gem_home
+ 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
+ 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
+ def self.dir
+ @gem_home ||= nil
+ set_home(ENV['GEM_HOME'] || default_dir) unless @gem_home
+ @gem_home
+ end
- # Set the Gem home directory (as reported by +dir+).
- def set_home(home)
- @gem_home = home
- ensure_gem_subdirectories(@gem_home)
+ 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
- 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
+ # Set the Gem home directory (as reported by +dir+).
+ def self.set_home(home)
+ @gem_home = home
+ ensure_gem_subdirectories(@gem_home)
+ end
- def ensure_gem_subdirectories(path)
+ 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
+ end
- Kernel.module_eval do
- undef_method :gem if method_defined? :gem
- 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')
+ $".delete File.join(Gem::ConfigMap[:libdir], 'ruby',
+ Gem::ConfigMap[:ruby_version], 'rubygems.rb')
- require 'rubygems'
- end
+ require 'rubygems'
end
GemPaths = {}