From e72b71d56a1f369cb7eb3892c61715460bac8109 Mon Sep 17 00:00:00 2001 From: drbrain Date: Fri, 11 Apr 2008 20:57:02 +0000 Subject: Update to RubyGems 1.1.1 r1701. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15980 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/rubygems.rb | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) (limited to 'lib/rubygems.rb') diff --git a/lib/rubygems.rb b/lib/rubygems.rb index 3f9657ac1e..1cb205cbc9 100644 --- a/lib/rubygems.rb +++ b/lib/rubygems.rb @@ -97,7 +97,7 @@ module Gem @configuration = nil @loaded_specs = {} - @platforms = nil + @platforms = [] @ruby = nil @sources = [] @@ -215,7 +215,7 @@ module Gem def self.bindir(install_dir=Gem.dir) return File.join(install_dir, 'bin') unless - install_dir.to_s == Gem.default_dir + install_dir.to_s == Gem.default_dir Gem.default_bindir end @@ -451,10 +451,21 @@ module Gem end ## - # Array of platforms this RubyGems supports. + # Set array of platforms this RubyGems supports (primarily for testing). + + def self.platforms=(platforms) + @platforms = platforms + end + ## + # Array of platforms this RubyGems supports. + def self.platforms - @platforms ||= [Gem::Platform::RUBY, Gem::Platform.local] + @platforms ||= [] + if @platforms.empty? + @platforms = [Gem::Platform::RUBY, Gem::Platform.local] + end + @platforms end ## @@ -463,13 +474,26 @@ module Gem def self.prefix prefix = File.dirname File.expand_path(__FILE__) - if prefix == File.expand_path(ConfigMap[:sitelibdir]) then + if File.dirname(prefix) == File.expand_path(ConfigMap[:sitelibdir]) or + File.dirname(prefix) == File.expand_path(ConfigMap[:libdir]) or + 'lib' != File.basename(prefix) then nil else File.dirname prefix end end + ## + # Refresh source_index from disk and clear searcher. + + def self.refresh + source_index.refresh! + + MUTEX.synchronize do + @searcher = nil + end + end + ## # Safely read a file in binary mode on all platforms. -- cgit v1.2.3