aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rubygems.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-09-13 19:58:57 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-09-13 19:58:57 +0000
commit1daa0b113d853bfa57b776cc569939b61ca14292 (patch)
treef8c4acb08a551820299dff2b13966d6ac38d31e4 /lib/rubygems.rb
parent85995e88d49c442b5b113c2676456133e79f5c02 (diff)
downloadruby-1daa0b113d853bfa57b776cc569939b61ca14292.tar.gz
* lib/rubygems: Update to RubyGems 2.1.3
Fixed installing platform gems Restored concurrent requires Fixed installing gems with extensions with --install-dir Fixed `gem fetch -v` to install the latest version Fixed installing gems with "./" in their files entries * test/rubygems/test_gem_package.rb: Tests for the above. * NEWS: Updated for RubyGems 2.1.3 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42938 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems.rb')
-rw-r--r--lib/rubygems.rb118
1 files changed, 16 insertions, 102 deletions
diff --git a/lib/rubygems.rb b/lib/rubygems.rb
index fac38e4143..78bdc4867d 100644
--- a/lib/rubygems.rb
+++ b/lib/rubygems.rb
@@ -8,7 +8,7 @@
require 'rbconfig'
module Gem
- VERSION = '2.1.3'
+ VERSION = '2.0.8'
end
# Must be first since it unloads the prelude from 1.9.2
@@ -115,7 +115,7 @@ module Gem
RUBYGEMS_DIR = File.dirname File.expand_path(__FILE__)
##
- # An Array of Regexps that match windows Ruby platforms.
+ # An Array of Regexps that match windows ruby platforms.
WIN_PATTERNS = [
/bccwin/i,
@@ -143,14 +143,6 @@ module Gem
specifications
]
- ##
- # Subdirectories in a gem repository for default gems
-
- REPOSITORY_DEFAULT_GEM_SUBDIRECTORIES = %w[
- gems
- specifications/default
- ]
-
@@win_platform = nil
@configuration = nil
@@ -387,10 +379,6 @@ module Gem
paths.path
end
- def self.spec_cache_dir
- paths.spec_cache_dir
- end
-
##
# Quietly ensure the Gem directory +dir+ contains all the proper
# subdirectories. If we can't create a directory due to a permission
@@ -401,23 +389,6 @@ module Gem
# World-writable directories will never be created.
def self.ensure_gem_subdirectories dir = Gem.dir, mode = nil
- ensure_subdirectories(dir, mode, REPOSITORY_SUBDIRECTORIES)
- end
-
- ##
- # Quietly ensure the Gem directory +dir+ contains all the proper
- # subdirectories for handling default gems. If we can't create a
- # directory due to a permission problem, then we will silently continue.
- #
- # If +mode+ is given, missing directories are created with this mode.
- #
- # World-writable directories will never be created.
-
- def self.ensure_default_gem_subdirectories dir = Gem.dir, mode = nil
- ensure_subdirectories(dir, mode, REPOSITORY_DEFAULT_GEM_SUBDIRECTORIES)
- end
-
- def self.ensure_subdirectories dir, mode, subdirs # :nodoc:
old_umask = File.umask
File.umask old_umask | 002
@@ -427,7 +398,7 @@ module Gem
options[:mode] = mode if mode
- subdirs.each do |name|
+ REPOSITORY_SUBDIRECTORIES.each do |name|
subdir = File.join dir, name
next if File.exist? subdir
FileUtils.mkdir_p subdir, options rescue nil
@@ -446,12 +417,16 @@ module Gem
# $LOAD_PATH for files as well as gems.
#
# Note that find_files will return all files even if they are from different
- # versions of the same gem. See also find_latest_files
+ # versions of the same gem.
def self.find_files(glob, check_load_path=true)
files = []
- files = find_files_from_load_path glob if check_load_path
+ if check_load_path
+ files = $LOAD_PATH.map { |load_path|
+ Dir["#{File.expand_path glob, load_path}#{Gem.suffix_pattern}"]
+ }.flatten.select { |file| File.file? file.untaint }
+ end
files.concat Gem::Specification.map { |spec|
spec.matches_for_glob("#{glob}#{Gem.suffix_pattern}")
@@ -464,40 +439,6 @@ module Gem
return files
end
- def self.find_files_from_load_path glob # :nodoc:
- $LOAD_PATH.map { |load_path|
- Dir["#{File.expand_path glob, load_path}#{Gem.suffix_pattern}"]
- }.flatten.select { |file| File.file? file.untaint }
- end
-
- ##
- # Returns a list of paths matching +glob+ from the latest gems that can be
- # used by a gem to pick up features from other gems. For example:
- #
- # Gem.find_latest_files('rdoc/discover').each do |path| load path end
- #
- # if +check_load_path+ is true (the default), then find_latest_files also
- # searches $LOAD_PATH for files as well as gems.
- #
- # Unlike find_files, find_latest_files will return only files from the
- # latest version of a gem.
-
- def self.find_latest_files(glob, check_load_path=true)
- files = []
-
- files = find_files_from_load_path glob if check_load_path
-
- files.concat Gem::Specification.latest_specs(true).map { |spec|
- spec.matches_for_glob("#{glob}#{Gem.suffix_pattern}")
- }.flatten
-
- # $LOAD_PATH might contain duplicate entries or reference
- # the spec dirs directly, so we prune.
- files.uniq! if check_load_path
-
- return files
- end
-
##
# Finds the user's home directory.
#--
@@ -852,7 +793,7 @@ module Gem
end
##
- # A Gem::Version for the currently running Ruby.
+ # A Gem::Version for the currently running ruby.
def self.ruby_version
return @ruby_version if defined? @ruby_version
@@ -975,9 +916,9 @@ module Gem
end
##
- # Load +plugins+ as Ruby files
+ # Load +plugins+ as ruby files
- def self.load_plugin_files plugins # :nodoc:
+ def self.load_plugin_files(plugins)
plugins.each do |plugin|
# Skip older versions of the GemCutter plugin: Its commands are in
@@ -995,16 +936,10 @@ module Gem
end
##
- # Find the 'rubygems_plugin' files in the latest installed gems and load
- # them
+ # Find all 'rubygems_plugin' files in installed gems and load them
def self.load_plugins
- # Remove this env var by at least 3.0
- if ENV['RUBYGEMS_LOAD_ALL_PLUGINS']
- load_plugin_files find_files('rubygems_plugin', false)
- else
- load_plugin_files find_latest_files('rubygems_plugin', false)
- end
+ load_plugin_files find_files('rubygems_plugin', false)
end
##
@@ -1036,31 +971,10 @@ module Gem
attr_reader :loaded_specs
##
- # Register a Gem::Specification for default gem.
- #
- # Two formats for the specification are supported:
- #
- # * MRI 2.0 style, where spec.files contains unprefixed require names.
- # The spec's filenames will be registered as-is.
- # * New style, where spec.files contains files prefixed with paths
- # from spec.require_paths. The prefixes are stripped before
- # registering the spec's filenames. Unprefixed files are omitted.
- #
+ # Register a Gem::Specification for default gem
def register_default_spec(spec)
- new_format = Gem.default_gems_use_full_paths? || spec.require_paths.any? {|path| spec.files.any? {|f| f.start_with? path } }
-
- if new_format
- prefix_group = spec.require_paths.map {|f| f + "/"}.join("|")
- prefix_pattern = /^(#{prefix_group})/
- end
-
spec.files.each do |file|
- if new_format
- file = file.sub(prefix_pattern, "")
- next unless $~
- end
-
@path_to_default_spec_map[file] = spec
end
end
@@ -1177,7 +1091,7 @@ unless gem_preluded then # TODO: remove guard after 1.9.2 dropped
if defined?(RUBY_ENGINE) then
begin
##
- # Defaults the Ruby implementation wants to provide for RubyGems
+ # Defaults the ruby implementation wants to provide for RubyGems
require "rubygems/defaults/#{RUBY_ENGINE}"
rescue LoadError