summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-02-01 08:19:06 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-02-01 08:19:06 +0000
commit8f87be4e22e61ca92c856ef977d0f6924974bdcf (patch)
tree1ed8dd47e10d06bd93c97206943e8bf3731adc0f
parent3efb494a213df6393a6f9aa83297e06bd68faa5e (diff)
Revert r44778 #9375
It breaks test-all if all tests are in a single process git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@44786 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog9
-rw-r--r--NEWS2
-rw-r--r--lib/rubygems.rb19
-rw-r--r--lib/rubygems/basic_specification.rb18
-rw-r--r--lib/rubygems/commands/contents_command.rb6
-rw-r--r--lib/rubygems/commands/install_command.rb20
-rw-r--r--lib/rubygems/commands/setup_command.rb16
-rw-r--r--lib/rubygems/compatibility.rb4
-rw-r--r--lib/rubygems/defaults.rb20
-rw-r--r--lib/rubygems/deprecate.rb2
-rw-r--r--lib/rubygems/installer.rb4
-rw-r--r--lib/rubygems/platform.rb2
-rw-r--r--lib/rubygems/rdoc.rb2
-rw-r--r--lib/rubygems/request_set/lockfile.rb7
-rw-r--r--lib/rubygems/resolver.rb21
-rw-r--r--lib/rubygems/resolver/installer_set.rb35
-rw-r--r--lib/rubygems/specification.rb2
-rw-r--r--lib/rubygems/test_case.rb12
-rw-r--r--lib/rubygems/uninstaller.rb2
-rw-r--r--test/rubygems/test_gem.rb102
-rw-r--r--test/rubygems/test_gem_commands_contents_command.rb6
-rw-r--r--test/rubygems/test_gem_commands_environment_command.rb2
-rw-r--r--test/rubygems/test_gem_commands_install_command.rb15
-rw-r--r--test/rubygems/test_gem_commands_update_command.rb2
-rw-r--r--test/rubygems/test_gem_dependency_installer.rb2
-rw-r--r--test/rubygems/test_gem_installer.rb8
-rw-r--r--test/rubygems/test_gem_request_set_lockfile.rb10
-rw-r--r--test/rubygems/test_gem_specification.rb50
-rw-r--r--test/rubygems/test_gem_uninstaller.rb17
-rw-r--r--version.h2
30 files changed, 163 insertions, 256 deletions
diff --git a/ChangeLog b/ChangeLog
index e88b8e1394..601436f326 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,12 +1,3 @@
-Fri Jan 31 18:13:43 2014 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems: Update to RubyGems master 21e409d / RubyGems 2.2.1.
-
- See http://rubygems.rubyforge.org/rubygems-update/History_txt.html
- for a list of bug fixes.
-
- * test/rubygems: ditto.
-
Fri Jan 31 12:10:16 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
* proc.c (mnew_from_me): keep iclass as-is, to make inheritance
diff --git a/NEWS b/NEWS
index f622b9f2ed..a096ad9d28 100644
--- a/NEWS
+++ b/NEWS
@@ -276,8 +276,6 @@ String
* Improved, iterative resolver (compared to RubyGems 2.1 and earlier)
* Support for a sharing a GEM_HOME across ruby platforms and versions
- * Updated to 2.2.1. Fixes some minor bugs and performance regressions.
-
For a complete list of enhancements and bug fixes see:
https://github.com/rubygems/rubygems/tree/master/History.txt
diff --git a/lib/rubygems.rb b/lib/rubygems.rb
index 7afc85bda5..73c4846f82 100644
--- a/lib/rubygems.rb
+++ b/lib/rubygems.rb
@@ -8,7 +8,7 @@
require 'rbconfig'
module Gem
- VERSION = '2.2.1'
+ VERSION = '2.2.0'
end
# Must be first since it unloads the prelude from 1.9.2
@@ -572,7 +572,7 @@ module Gem
# gem's paths are inserted before site lib directory by default.
def self.load_path_insert_index
- index = $LOAD_PATH.index RbConfig::CONFIG['sitelibdir']
+ index = $LOAD_PATH.index ConfigMap[:sitelibdir]
index
end
@@ -743,8 +743,8 @@ module Gem
def self.prefix
prefix = File.dirname RUBYGEMS_DIR
- if prefix != File.expand_path(RbConfig::CONFIG['sitelibdir']) and
- prefix != File.expand_path(RbConfig::CONFIG['libdir']) and
+ if prefix != File.expand_path(ConfigMap[:sitelibdir]) and
+ prefix != File.expand_path(ConfigMap[:libdir]) and
'lib' == File.basename(RUBYGEMS_DIR) then
prefix
end
@@ -765,10 +765,6 @@ module Gem
f.flock(File::LOCK_EX)
f.read
end
- rescue Errno::EACCES
- open path, 'rb' do |f|
- f.read
- end
end
##
@@ -776,8 +772,8 @@ module Gem
def self.ruby
if @ruby.nil? then
- @ruby = File.join(RbConfig::CONFIG['bindir'],
- "#{RbConfig::CONFIG['ruby_install_name']}#{RbConfig::CONFIG['EXEEXT']}")
+ @ruby = File.join(ConfigMap[:bindir],
+ "#{ConfigMap[:ruby_install_name]}#{ConfigMap[:EXEEXT]}")
@ruby = "\"#{@ruby}\"" if @ruby =~ /\s/
end
@@ -789,7 +785,8 @@ module Gem
# Returns a String containing the API compatibility version of Ruby
def self.ruby_api_version
- @ruby_api_version ||= RbConfig::CONFIG['ruby_version'].dup
+ @ruby_api_version ||=
+ "#{ConfigMap[:MAJOR]}.#{ConfigMap[:MINOR]}.#{ConfigMap[:TEENY]}"
end
##
diff --git a/lib/rubygems/basic_specification.rb b/lib/rubygems/basic_specification.rb
index 470a6ebc8b..a52377ff22 100644
--- a/lib/rubygems/basic_specification.rb
+++ b/lib/rubygems/basic_specification.rb
@@ -207,24 +207,6 @@ class Gem::BasicSpecification
end
##
- # Returns the paths to the source files for use with analysis and
- # documentation tools. These paths are relative to full_gem_path.
-
- def source_paths
- paths = raw_require_paths.dup
-
- if @extensions then
- ext_dirs = @extensions.map do |extension|
- extension.split(File::SEPARATOR, 2).first
- end.uniq
-
- paths.concat ext_dirs
- end
-
- paths.uniq
- end
-
- ##
# Return a Gem::Specification from this gem
def to_spec
diff --git a/lib/rubygems/commands/contents_command.rb b/lib/rubygems/commands/contents_command.rb
index 603f1d072a..97218848ed 100644
--- a/lib/rubygems/commands/contents_command.rb
+++ b/lib/rubygems/commands/contents_command.rb
@@ -94,11 +94,11 @@ prefix or only the files that are requireable.
spec.files.sort.map do |file|
case file
when /\A#{spec.bindir}\//
- [RbConfig::CONFIG['bindir'], $POSTMATCH]
+ [Gem::ConfigMap[:bindir], $POSTMATCH]
when /\.so\z/
- [RbConfig::CONFIG['archdir'], file]
+ [Gem::ConfigMap[:archdir], file]
else
- [RbConfig::CONFIG['rubylibdir'], file]
+ [Gem::ConfigMap[:rubylibdir], file]
end
end
end
diff --git a/lib/rubygems/commands/install_command.rb b/lib/rubygems/commands/install_command.rb
index 8219eef6ea..4485eb12e8 100644
--- a/lib/rubygems/commands/install_command.rb
+++ b/lib/rubygems/commands/install_command.rb
@@ -228,18 +228,7 @@ to write the specification by hand. For example:
def install_gem_without_dependencies name, req # :nodoc:
gem = nil
- if local? then
- if name =~ /\.gem$/ and File.file? name then
- source = Gem::Source::SpecificFile.new name
- spec = source.spec
- else
- source = Gem::Source::Local.new
- spec = source.find_gem name, req
- end
- gem = source.download spec if spec
- end
-
- if remote? and not gem then
+ if remote? then
dependency = Gem::Dependency.new name, req
dependency.prerelease = options[:prerelease]
@@ -247,6 +236,13 @@ to write the specification by hand. For example:
gem = fetcher.download_to_cache dependency
end
+ if local? and not gem then
+ source = Gem::Source::Local.new
+ spec = source.find_gem name, req
+
+ gem = source.download spec
+ end
+
inst = Gem::Installer.new gem, options
inst.install
diff --git a/lib/rubygems/commands/setup_command.rb b/lib/rubygems/commands/setup_command.rb
index 681db0dc1d..face77fae9 100644
--- a/lib/rubygems/commands/setup_command.rb
+++ b/lib/rubygems/commands/setup_command.rb
@@ -13,7 +13,7 @@ class Gem::Commands::SetupCommand < Gem::Command
super 'setup', 'Install RubyGems',
:format_executable => true, :document => %w[ri],
- :site_or_vendor => 'sitelibdir',
+ :site_or_vendor => :sitelibdir,
:destdir => '', :prefix => '', :previous_version => ''
add_option '--previous-version=VERSION',
@@ -36,7 +36,7 @@ class Gem::Commands::SetupCommand < Gem::Command
add_option '--[no-]vendor',
'Install into vendorlibdir not sitelibdir' do |vendor, options|
- options[:site_or_vendor] = vendor ? 'vendorlibdir' : 'sitelibdir'
+ options[:site_or_vendor] = vendor ? :vendorlibdir : :sitelibdir
end
add_option '--[no-]format-executable',
@@ -343,19 +343,19 @@ TEXT
site_or_vendor = options[:site_or_vendor]
if prefix.empty? then
- lib_dir = RbConfig::CONFIG[site_or_vendor]
- bin_dir = RbConfig::CONFIG['bindir']
+ lib_dir = Gem::ConfigMap[site_or_vendor]
+ bin_dir = Gem::ConfigMap[:bindir]
else
# Apple installed RubyGems into libdir, and RubyGems <= 1.1.0 gets
# confused about installation location, so switch back to
# sitelibdir/vendorlibdir.
if defined?(APPLE_GEM_HOME) and
# just in case Apple and RubyGems don't get this patched up proper.
- (prefix == RbConfig::CONFIG['libdir'] or
+ (prefix == Gem::ConfigMap[:libdir] or
# this one is important
- prefix == File.join(RbConfig::CONFIG['libdir'], 'ruby')) then
- lib_dir = RbConfig::CONFIG[site_or_vendor]
- bin_dir = RbConfig::CONFIG['bindir']
+ prefix == File.join(Gem::ConfigMap[:libdir], 'ruby')) then
+ lib_dir = Gem::ConfigMap[site_or_vendor]
+ bin_dir = Gem::ConfigMap[:bindir]
else
lib_dir = File.join prefix, 'lib'
bin_dir = File.join prefix, 'bin'
diff --git a/lib/rubygems/compatibility.rb b/lib/rubygems/compatibility.rb
index d06ade1fa6..5e8618fe39 100644
--- a/lib/rubygems/compatibility.rb
+++ b/lib/rubygems/compatibility.rb
@@ -33,8 +33,6 @@ end
module Gem
RubyGemsVersion = VERSION
- # TODO remove at RubyGems 3
-
RbConfigPriorities = %w[
MAJOR
MINOR
@@ -47,7 +45,7 @@ module Gem
unless defined?(ConfigMap)
##
# Configuration settings from ::RbConfig
- ConfigMap = Hash.new do |cm, key| # TODO remove at RubyGems 3
+ ConfigMap = Hash.new do |cm, key|
cm[key] = RbConfig::CONFIG[key.to_s]
end
else
diff --git a/lib/rubygems/defaults.rb b/lib/rubygems/defaults.rb
index 6924f48e5a..715c0b71b3 100644
--- a/lib/rubygems/defaults.rb
+++ b/lib/rubygems/defaults.rb
@@ -29,22 +29,22 @@ module Gem
def self.default_dir
path = if defined? RUBY_FRAMEWORK_VERSION then
[
- File.dirname(RbConfig::CONFIG['sitedir']),
+ File.dirname(ConfigMap[:sitedir]),
'Gems',
- RbConfig::CONFIG['ruby_version']
+ ConfigMap[:ruby_version]
]
- elsif RbConfig::CONFIG['rubylibprefix'] then
+ elsif ConfigMap[:rubylibprefix] then
[
- RbConfig::CONFIG['rubylibprefix'],
+ ConfigMap[:rubylibprefix],
'gems',
- RbConfig::CONFIG['ruby_version']
+ ConfigMap[:ruby_version]
]
else
[
- RbConfig::CONFIG['libdir'],
+ ConfigMap[:libdir],
ruby_engine,
'gems',
- RbConfig::CONFIG['ruby_version']
+ ConfigMap[:ruby_version]
]
end
@@ -74,7 +74,7 @@ module Gem
def self.user_dir
parts = [Gem.user_home, '.gem', ruby_engine]
- parts << RbConfig::CONFIG['ruby_version'] unless RbConfig::CONFIG['ruby_version'].empty?
+ parts << ConfigMap[:ruby_version] unless ConfigMap[:ruby_version].empty?
File.join parts
end
@@ -100,7 +100,7 @@ module Gem
# Deduce Ruby's --program-prefix and --program-suffix from its install name
def self.default_exec_format
- exec_format = RbConfig::CONFIG['ruby_install_name'].sub('ruby', '%s') rescue '%s'
+ exec_format = ConfigMap[:ruby_install_name].sub('ruby', '%s') rescue '%s'
unless exec_format =~ /%s/ then
raise Gem::Exception,
@@ -117,7 +117,7 @@ module Gem
if defined? RUBY_FRAMEWORK_VERSION then # mac framework support
'/usr/bin'
else # generic install
- RbConfig::CONFIG['bindir']
+ ConfigMap[:bindir]
end
end
diff --git a/lib/rubygems/deprecate.rb b/lib/rubygems/deprecate.rb
index e19360da13..274d6a5c12 100644
--- a/lib/rubygems/deprecate.rb
+++ b/lib/rubygems/deprecate.rb
@@ -50,7 +50,7 @@ module Gem::Deprecate
class_eval {
old = "_deprecated_#{name}"
alias_method old, name
- define_method name do |*args, &block|
+ define_method name do |*args, &block| # TODO: really works on 1.8.7?
klass = self.kind_of? Module
target = klass ? "#{self}." : "#{self.class}#"
msg = [ "NOTE: #{target}#{name} is deprecated",
diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb
index 33d2f78d46..f8eb2c2145 100644
--- a/lib/rubygems/installer.rb
+++ b/lib/rubygems/installer.rb
@@ -480,7 +480,7 @@ class Gem::Installer
#
def shebang(bin_file_name)
- ruby_name = RbConfig::CONFIG['ruby_install_name'] if @env_shebang
+ ruby_name = Gem::ConfigMap[:ruby_install_name] if @env_shebang
path = File.join gem_dir, spec.bindir, bin_file_name
first_line = File.open(path, "rb") {|file| file.gets}
@@ -493,7 +493,7 @@ class Gem::Installer
if which = Gem.configuration[:custom_shebang]
# replace bin_file_name with "ruby" to avoid endless loops
- which = which.gsub(/ #{bin_file_name}$/," #{RbConfig::CONFIG['ruby_install_name']}")
+ which = which.gsub(/ #{bin_file_name}$/," #{Gem::ConfigMap[:ruby_install_name]}")
which = which.gsub(/\$(\w+)/) do
case $1
diff --git a/lib/rubygems/platform.rb b/lib/rubygems/platform.rb
index 1bcd7549ad..e050959dc6 100644
--- a/lib/rubygems/platform.rb
+++ b/lib/rubygems/platform.rb
@@ -16,7 +16,7 @@ class Gem::Platform
attr_accessor :version
def self.local
- arch = RbConfig::CONFIG['arch']
+ arch = Gem::ConfigMap[:arch]
arch = "#{arch}_60" if arch =~ /mswin32$/
@local ||= new(arch)
end
diff --git a/lib/rubygems/rdoc.rb b/lib/rubygems/rdoc.rb
index 633bd893a5..52249dc267 100644
--- a/lib/rubygems/rdoc.rb
+++ b/lib/rubygems/rdoc.rb
@@ -193,7 +193,7 @@ class Gem::RDoc # :nodoc: all
::RDoc::Parser::C.reset
args = @spec.rdoc_options
- args.concat @spec.source_paths
+ args.concat @spec.require_paths
args.concat @spec.extra_rdoc_files
case config_args = Gem.configuration[:rdoc]
diff --git a/lib/rubygems/request_set/lockfile.rb b/lib/rubygems/request_set/lockfile.rb
index 0433d2a7fc..522caf1502 100644
--- a/lib/rubygems/request_set/lockfile.rb
+++ b/lib/rubygems/request_set/lockfile.rb
@@ -303,12 +303,7 @@ class Gem::RequestSet::Lockfile
type, data, = get [:text, :requirement]
if type == :text and column == 4 then
- version, platform = data.split '-', 2
-
- platform =
- platform ? Gem::Platform.new(platform) : Gem::Platform::RUBY
-
- last_spec = set.add name, version, platform
+ last_spec = set.add name, data, Gem::Platform::RUBY
else
dependency = parse_dependency name, data
diff --git a/lib/rubygems/resolver.rb b/lib/rubygems/resolver.rb
index 15a96693e9..d455e03c05 100644
--- a/lib/rubygems/resolver.rb
+++ b/lib/rubygems/resolver.rb
@@ -179,6 +179,27 @@ class Gem::Resolver
end
##
+ # Finds the State in +states+ that matches the +conflict+ so that we can try
+ # other possible sets.
+ #
+ # If no good candidate is found, the first state is tried.
+
+ def find_conflict_state conflict, states # :nodoc:
+ until states.empty? do
+ state = states.pop
+
+ explain :consider, state.dep, conflict.failed_dep
+
+ if conflict.for_spec? state.spec
+ state.conflicts << [state.spec, conflict]
+ return state
+ end
+ end
+
+ nil
+ end
+
+ ##
# Extracts the specifications that may be able to fulfill +dependency+ and
# returns those that match the local platform and all those that match.
diff --git a/lib/rubygems/resolver/installer_set.rb b/lib/rubygems/resolver/installer_set.rb
index 27e6455148..e35e0aabec 100644
--- a/lib/rubygems/resolver/installer_set.rb
+++ b/lib/rubygems/resolver/installer_set.rb
@@ -28,10 +28,11 @@ class Gem::Resolver::InstallerSet < Gem::Resolver::Set
@f = Gem::SpecFetcher.fetcher
+ @all = Hash.new { |h,k| h[k] = [] }
@always_install = []
@ignore_dependencies = false
@ignore_installed = false
- @remote_set = Gem::Resolver::BestSet.new if consider_remote?
+ @loaded_remote_specs = []
@specs = {}
end
@@ -78,7 +79,16 @@ class Gem::Resolver::InstallerSet < Gem::Resolver::Set
end
end
- res.concat @remote_set.find_all req if consider_remote?
+ if consider_remote? then
+ load_remote_specs dep
+
+ @all[name].each do |remote_source, n|
+ if dep.match? n then
+ res << Gem::Resolver::IndexSpecification.new(
+ self, n.name, n.version, remote_source, n.platform)
+ end
+ end
+ end
res
end
@@ -92,6 +102,27 @@ class Gem::Resolver::InstallerSet < Gem::Resolver::Set
end
##
+ # Loads remote prerelease specs if +dep+ is a prerelease dependency
+
+ def load_remote_specs dep # :nodoc:
+ types = [:released]
+ types << :prerelease if dep.prerelease?
+
+ types.each do |type|
+ next if @loaded_remote_specs.include? type
+ @loaded_remote_specs << type
+
+ list, = @f.available_specs type
+
+ list.each do |uri, specs|
+ specs.each do |n|
+ @all[n.name] << [uri, n]
+ end
+ end
+ end
+ end
+
+ ##
# Called from IndexSpecification to get a true Specification
# object.
diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb
index e98f3284cd..59d71d378b 100644
--- a/lib/rubygems/specification.rb
+++ b/lib/rubygems/specification.rb
@@ -327,7 +327,7 @@ class Gem::Specification < Gem::BasicSpecification
add_bindir(@executables),
@extra_rdoc_files,
@extensions,
- ].flatten.uniq.compact.sort
+ ].flatten.sort.uniq.compact
end
######################################################################
diff --git a/lib/rubygems/test_case.rb b/lib/rubygems/test_case.rb
index ff261f7816..8dc37d6720 100644
--- a/lib/rubygems/test_case.rb
+++ b/lib/rubygems/test_case.rb
@@ -294,10 +294,10 @@ class Gem::TestCase < MiniTest::Unit::TestCase
Gem.searcher = nil
Gem::SpecFetcher.fetcher = nil
- @orig_BASERUBY = RbConfig::CONFIG['BASERUBY']
- RbConfig::CONFIG['BASERUBY'] = RbConfig::CONFIG['ruby_install_name']
+ @orig_BASERUBY = Gem::ConfigMap[:BASERUBY]
+ Gem::ConfigMap[:BASERUBY] = Gem::ConfigMap[:ruby_install_name]
- @orig_arch = RbConfig::CONFIG['arch']
+ @orig_arch = Gem::ConfigMap[:arch]
if win_platform?
util_set_arch 'i386-mswin32'
@@ -315,8 +315,8 @@ class Gem::TestCase < MiniTest::Unit::TestCase
def teardown
$LOAD_PATH.replace @orig_LOAD_PATH if @orig_LOAD_PATH
- RbConfig::CONFIG['BASERUBY'] = @orig_BASERUBY
- RbConfig::CONFIG['arch'] = @orig_arch
+ Gem::ConfigMap[:BASERUBY] = @orig_BASERUBY
+ Gem::ConfigMap[:arch] = @orig_arch
if defined? Gem::RemoteFetcher then
Gem::RemoteFetcher.fetcher = nil
@@ -898,7 +898,7 @@ Also, a list:
# Set the platform to +arch+
def util_set_arch(arch)
- RbConfig::CONFIG['arch'] = arch
+ Gem::ConfigMap[:arch] = arch
platform = Gem::Platform.new arch
Gem.instance_variable_set :@platforms, nil
diff --git a/lib/rubygems/uninstaller.rb b/lib/rubygems/uninstaller.rb
index fa838333cd..4cb2a1d333 100644
--- a/lib/rubygems/uninstaller.rb
+++ b/lib/rubygems/uninstaller.rb
@@ -237,7 +237,7 @@ class Gem::Uninstaller
unless path_ok?(@gem_home, spec) or
(@user_install and path_ok?(Gem.user_dir, spec)) then
e = Gem::GemNotInHomeException.new \
- "Gem '#{spec.full_name}' is not installed in directory #{@gem_home}"
+ "Gem is not installed in directory #{@gem_home}"
e.spec = spec
raise e
diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb
index 513f2d4e58..759c2fe907 100644
--- a/test/rubygems/test_gem.rb
+++ b/test/rubygems/test_gem.rb
@@ -199,30 +199,30 @@ class TestGem < Gem::TestCase
end
def test_self_default_exec_format
- orig_RUBY_INSTALL_NAME = RbConfig::CONFIG['ruby_install_name']
- RbConfig::CONFIG['ruby_install_name'] = 'ruby'
+ orig_RUBY_INSTALL_NAME = Gem::ConfigMap[:ruby_install_name]
+ Gem::ConfigMap[:ruby_install_name] = 'ruby'
assert_equal '%s', Gem.default_exec_format
ensure
- RbConfig::CONFIG['ruby_install_name'] = orig_RUBY_INSTALL_NAME
+ Gem::ConfigMap[:ruby_install_name] = orig_RUBY_INSTALL_NAME
end
def test_self_default_exec_format_18
- orig_RUBY_INSTALL_NAME = RbConfig::CONFIG['ruby_install_name']
- RbConfig::CONFIG['ruby_install_name'] = 'ruby18'
+ orig_RUBY_INSTALL_NAME = Gem::ConfigMap[:ruby_install_name]
+ Gem::ConfigMap[:ruby_install_name] = 'ruby18'
assert_equal '%s18', Gem.default_exec_format
ensure
- RbConfig::CONFIG['ruby_install_name'] = orig_RUBY_INSTALL_NAME
+ Gem::ConfigMap[:ruby_install_name] = orig_RUBY_INSTALL_NAME
end
def test_self_default_exec_format_jruby
- orig_RUBY_INSTALL_NAME = RbConfig::CONFIG['ruby_install_name']
- RbConfig::CONFIG['ruby_install_name'] = 'jruby'
+ orig_RUBY_INSTALL_NAME = Gem::ConfigMap[:ruby_install_name]
+ Gem::ConfigMap[:ruby_install_name] = 'jruby'
assert_equal 'j%s', Gem.default_exec_format
ensure
- RbConfig::CONFIG['ruby_install_name'] = orig_RUBY_INSTALL_NAME
+ Gem::ConfigMap[:ruby_install_name] = orig_RUBY_INSTALL_NAME
end
def test_self_default_sources
@@ -230,7 +230,6 @@ class TestGem < Gem::TestCase
end
def test_self_detect_gemdeps
- skip 'Insecure operation - chdir' if RUBY_VERSION <= "1.8.7"
rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], '-'
FileUtils.mkdir_p 'detect/a/b'
@@ -566,43 +565,24 @@ class TestGem < Gem::TestCase
end
def test_self_prefix_libdir
- orig_libdir = RbConfig::CONFIG['libdir']
- RbConfig::CONFIG['libdir'] = @@project_dir
+ orig_libdir = Gem::ConfigMap[:libdir]
+ Gem::ConfigMap[:libdir] = @@project_dir
assert_nil Gem.prefix
ensure
- RbConfig::CONFIG['libdir'] = orig_libdir
+ Gem::ConfigMap[:libdir] = orig_libdir
end
def test_self_prefix_sitelibdir
- orig_sitelibdir = RbConfig::CONFIG['sitelibdir']
- RbConfig::CONFIG['sitelibdir'] = @@project_dir
+ orig_sitelibdir = Gem::ConfigMap[:sitelibdir]
+ Gem::ConfigMap[:sitelibdir] = @@project_dir
assert_nil Gem.prefix
ensure
- RbConfig::CONFIG['sitelibdir'] = orig_sitelibdir
- end
-
- def test_self_read_binary
- open 'test', 'w' do |io|
- io.write "\xCF\x80"
- end
-
- assert_equal ["\xCF", "\x80"], Gem.read_binary('test').chars.to_a
-
- skip 'chmod not supported' if Gem.win_platform?
-
- begin
- File.chmod 0444, 'test'
-
- assert_equal ["\xCF", "\x80"], Gem.read_binary('test').chars.to_a
- ensure
- File.chmod 0644, 'test'
- end
+ Gem::ConfigMap[:sitelibdir] = orig_sitelibdir
end
def test_self_refresh
- skip 'Insecure operation - mkdir' if RUBY_VERSION <= "1.8.7"
util_make_gems
a1_spec = @a1.spec_file
@@ -622,7 +602,6 @@ class TestGem < Gem::TestCase
end
def test_self_refresh_keeps_loaded_specs_activated
- skip 'Insecure operation - mkdir' if RUBY_VERSION <= "1.8.7"
util_make_gems
a1_spec = @a1.spec_file
@@ -645,44 +624,46 @@ class TestGem < Gem::TestCase
def test_self_ruby_escaping_spaces_in_path
orig_ruby = Gem.ruby
- orig_bindir = RbConfig::CONFIG['bindir']
- orig_ruby_install_name = RbConfig::CONFIG['ruby_install_name']
- orig_exe_ext = RbConfig::CONFIG['EXEEXT']
+ orig_bindir = Gem::ConfigMap[:bindir]
+ orig_ruby_install_name = Gem::ConfigMap[:ruby_install_name]
+ orig_exe_ext = Gem::ConfigMap[:EXEEXT]
- RbConfig::CONFIG['bindir'] = "C:/Ruby 1.8/bin"
- RbConfig::CONFIG['ruby_install_name'] = "ruby"
- RbConfig::CONFIG['EXEEXT'] = ".exe"
+ Gem::ConfigMap[:bindir] = "C:/Ruby 1.8/bin"
+ Gem::ConfigMap[:ruby_install_name] = "ruby"
+ Gem::ConfigMap[:EXEEXT] = ".exe"
Gem.instance_variable_set("@ruby", nil)
assert_equal "\"C:/Ruby 1.8/bin/ruby.exe\"", Gem.ruby
ensure
Gem.instance_variable_set("@ruby", orig_ruby)
- RbConfig::CONFIG['bindir'] = orig_bindir
- RbConfig::CONFIG['ruby_install_name'] = orig_ruby_install_name
- RbConfig::CONFIG['EXEEXT'] = orig_exe_ext
+ Gem::ConfigMap[:bindir] = orig_bindir
+ Gem::ConfigMap[:ruby_install_name] = orig_ruby_install_name
+ Gem::ConfigMap[:EXEEXT] = orig_exe_ext
end
def test_self_ruby_path_without_spaces
orig_ruby = Gem.ruby
- orig_bindir = RbConfig::CONFIG['bindir']
- orig_ruby_install_name = RbConfig::CONFIG['ruby_install_name']
- orig_exe_ext = RbConfig::CONFIG['EXEEXT']
+ orig_bindir = Gem::ConfigMap[:bindir]
+ orig_ruby_install_name = Gem::ConfigMap[:ruby_install_name]
+ orig_exe_ext = Gem::ConfigMap[:EXEEXT]
- RbConfig::CONFIG['bindir'] = "C:/Ruby18/bin"
- RbConfig::CONFIG['ruby_install_name'] = "ruby"
- RbConfig::CONFIG['EXEEXT'] = ".exe"
+ Gem::ConfigMap[:bindir] = "C:/Ruby18/bin"
+ Gem::ConfigMap[:ruby_install_name] = "ruby"
+ Gem::ConfigMap[:EXEEXT] = ".exe"
Gem.instance_variable_set("@ruby", nil)
assert_equal "C:/Ruby18/bin/ruby.exe", Gem.ruby
ensure
Gem.instance_variable_set("@ruby", orig_ruby)
- RbConfig::CONFIG['bindir'] = orig_bindir
- RbConfig::CONFIG['ruby_install_name'] = orig_ruby_install_name
- RbConfig::CONFIG['EXEEXT'] = orig_exe_ext
+ Gem::ConfigMap[:bindir] = orig_bindir
+ Gem::ConfigMap[:ruby_install_name] = orig_ruby_install_name
+ Gem::ConfigMap[:EXEEXT] = orig_exe_ext
end
def test_self_ruby_api_version
- orig_ruby_version, RbConfig::CONFIG['ruby_version'] = RbConfig::CONFIG['ruby_version'], '1.2.3'
+ orig_MAJOR, Gem::ConfigMap[:MAJOR] = Gem::ConfigMap[:MAJOR], '1'
+ orig_MINOR, Gem::ConfigMap[:MINOR] = Gem::ConfigMap[:MINOR], '2'
+ orig_TEENY, Gem::ConfigMap[:TEENY] = Gem::ConfigMap[:TEENY], '3'
Gem.instance_variable_set :@ruby_api_version, nil
@@ -690,7 +671,9 @@ class TestGem < Gem::TestCase
ensure
Gem.instance_variable_set :@ruby_api_version, nil
- RbConfig::CONFIG['ruby_version'] = orig_ruby_version
+ Gem::ConfigMap[:MAJOR] = orig_MAJOR
+ Gem::ConfigMap[:MINOR] = orig_MINOR
+ Gem::ConfigMap[:TEENY] = orig_TEENY
end
def test_self_ruby_version_1_8_5
@@ -842,7 +825,7 @@ class TestGem < Gem::TestCase
def test_self_user_dir
parts = [@userhome, '.gem', Gem.ruby_engine]
- parts << RbConfig::CONFIG['ruby_version'] unless RbConfig::CONFIG['ruby_version'].empty?
+ parts << Gem::ConfigMap[:ruby_version] unless Gem::ConfigMap[:ruby_version].empty?
assert_equal File.join(parts), Gem.user_dir
end
@@ -874,7 +857,6 @@ class TestGem < Gem::TestCase
end
def test_self_needs_picks_up_unresolved_deps
- skip 'loading from unsafe file' if RUBY_VERSION <= "1.8.7"
save_loaded_features do
util_clear_gems
a = util_spec "a", "1"
@@ -967,7 +949,6 @@ class TestGem < Gem::TestCase
end
def test_load_plugins
- skip 'Insecure operation - chdir' if RUBY_VERSION <= "1.8.7"
plugin_path = File.join "lib", "rubygems_plugin.rb"
Dir.chdir @tempdir do
@@ -1121,7 +1102,6 @@ class TestGem < Gem::TestCase
end
def test_auto_activation_of_detected_gemdeps_file
- skip 'Insecure operation - chdir' if RUBY_VERSION <= "1.8.7"
util_clear_gems
a = new_spec "a", "1", nil, "lib/a.rb"
@@ -1284,7 +1264,6 @@ class TestGem < Gem::TestCase
end
def test_use_gemdeps_automatic
- skip 'Insecure operation - chdir' if RUBY_VERSION <= "1.8.7"
rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], '-'
spec = util_spec 'a', 1
@@ -1321,7 +1300,6 @@ class TestGem < Gem::TestCase
end
def test_use_gemdeps_specific
- skip 'Insecure operation - read' if RUBY_VERSION <= "1.8.7"
rubygems_gemdeps, ENV['RUBYGEMS_GEMDEPS'] = ENV['RUBYGEMS_GEMDEPS'], 'x'
spec = util_spec 'a', 1
diff --git a/test/rubygems/test_gem_commands_contents_command.rb b/test/rubygems/test_gem_commands_contents_command.rb
index 7f5cf22223..d87e84fc82 100644
--- a/test/rubygems/test_gem_commands_contents_command.rb
+++ b/test/rubygems/test_gem_commands_contents_command.rb
@@ -169,9 +169,9 @@ lib/foo.rb
end
expected = [
- File.join(RbConfig::CONFIG['bindir'], 'default_command'),
- File.join(RbConfig::CONFIG['rubylibdir'], 'default/gem.rb'),
- File.join(RbConfig::CONFIG['archdir'], 'default_gem.so')
+ File.join(Gem::ConfigMap[:bindir], 'default_command'),
+ File.join(Gem::ConfigMap[:rubylibdir], 'default/gem.rb'),
+ File.join(Gem::ConfigMap[:archdir], 'default_gem.so')
].sort.join "\n"
assert_equal expected, @ui.output.chomp
diff --git a/test/rubygems/test_gem_commands_environment_command.rb b/test/rubygems/test_gem_commands_environment_command.rb
index bb7589f50d..253c459d94 100644
--- a/test/rubygems/test_gem_commands_environment_command.rb
+++ b/test/rubygems/test_gem_commands_environment_command.rb
@@ -26,7 +26,7 @@ class TestGemCommandsEnvironmentCommand < Gem::TestCase
assert_match %r|INSTALLATION DIRECTORY: #{Regexp.escape @gemhome}|,
@ui.output
assert_match %r|RUBYGEMS PREFIX: |, @ui.output
- assert_match %r|RUBY EXECUTABLE:.*#{RbConfig::CONFIG['ruby_install_name']}|,
+ assert_match %r|RUBY EXECUTABLE:.*#{Gem::ConfigMap[:ruby_install_name]}|,
@ui.output
assert_match %r|EXECUTABLE DIRECTORY:|, @ui.output
assert_match %r|RUBYGEMS PLATFORMS:|, @ui.output
diff --git a/test/rubygems/test_gem_commands_install_command.rb b/test/rubygems/test_gem_commands_install_command.rb
index 6315cb5d95..00bbf7bae7 100644
--- a/test/rubygems/test_gem_commands_install_command.rb
+++ b/test/rubygems/test_gem_commands_install_command.rb
@@ -316,7 +316,6 @@ ERROR: Possible alternatives: non_existent_with_hint
end
def test_execute_rdoc
- skip if RUBY_VERSION <= "1.8.7"
specs = spec_fetcher do |fetcher|
fetcher.gem 'a', 2
end
@@ -560,20 +559,6 @@ ERROR: Possible alternatives: non_existent_with_hint
assert_equal %w[a-2], @cmd.installed_specs.map { |spec| spec.full_name }
end
- def test_install_gem_ignore_dependencies_specific_file
- spec = quick_spec 'a', 2
-
- util_build_gem spec
-
- FileUtils.mv spec.cache_file, @tempdir
-
- @cmd.options[:ignore_dependencies] = true
-
- @cmd.install_gem File.join(@tempdir, spec.file_name), nil
-
- assert_equal %w[a-2], @cmd.installed_specs.map { |s| s.full_name }
- end
-
def test_parses_requirement_from_gemname
spec_fetcher do |fetcher|
fetcher.gem 'a', 2
diff --git a/test/rubygems/test_gem_commands_update_command.rb b/test/rubygems/test_gem_commands_update_command.rb
index d259383ba2..7537c1c9c1 100644
--- a/test/rubygems/test_gem_commands_update_command.rb
+++ b/test/rubygems/test_gem_commands_update_command.rb
@@ -217,7 +217,6 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
end
def test_execute_rdoc
- skip if RUBY_VERSION <= "1.8.7"
spec_fetcher do |fetcher|
fetcher.gem 'a', 2
@@ -240,6 +239,7 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
a2 = @specs['a-2']
+ assert_path_exists File.join(a2.doc_dir, 'ri')
assert_path_exists File.join(a2.doc_dir, 'rdoc')
end
diff --git a/test/rubygems/test_gem_dependency_installer.rb b/test/rubygems/test_gem_dependency_installer.rb
index 352ebbb54f..0a82fa63cb 100644
--- a/test/rubygems/test_gem_dependency_installer.rb
+++ b/test/rubygems/test_gem_dependency_installer.rb
@@ -551,7 +551,7 @@ class TestGemDependencyInstaller < Gem::TestCase
env = "/\\S+/env" unless Gem.win_platform?
- assert_match %r|\A#!#{env} #{RbConfig::CONFIG['ruby_install_name']}\n|,
+ assert_match %r|\A#!#{env} #{Gem::ConfigMap[:ruby_install_name]}\n|,
File.read(File.join(@gemhome, 'bin', 'a_bin'))
end
diff --git a/test/rubygems/test_gem_installer.rb b/test/rubygems/test_gem_installer.rb
index 54ac853135..615a9b57ba 100644
--- a/test/rubygems/test_gem_installer.rb
+++ b/test/rubygems/test_gem_installer.rb
@@ -84,8 +84,8 @@ load Gem.bin_path('a', 'executable', version)
orig_RUBY_FRAMEWORK_VERSION = RUBY_FRAMEWORK_VERSION
Object.send :remove_const, :RUBY_FRAMEWORK_VERSION
end
- orig_bindir = RbConfig::CONFIG['bindir']
- RbConfig::CONFIG['bindir'] = Gem.bindir
+ orig_bindir = Gem::ConfigMap[:bindir]
+ Gem::ConfigMap[:bindir] = Gem.bindir
util_conflict_executable false
@@ -102,7 +102,7 @@ load Gem.bin_path('a', 'executable', version)
ensure
Object.const_set :RUBY_FRAMEWORK_VERSION, orig_RUBY_FRAMEWORK_VERSION if
orig_RUBY_FRAMEWORK_VERSION
- RbConfig::CONFIG['bindir'] = orig_bindir
+ Gem::ConfigMap[:bindir] = orig_bindir
end
def test_check_executable_overwrite_format_executable
@@ -1192,7 +1192,7 @@ gem 'other', version
env_shebang = "/usr/bin/env" unless Gem.win_platform?
- assert_equal("#!#{env_shebang} #{RbConfig::CONFIG['ruby_install_name']}",
+ assert_equal("#!#{env_shebang} #{Gem::ConfigMap[:ruby_install_name]}",
shebang)
end
diff --git a/test/rubygems/test_gem_request_set_lockfile.rb b/test/rubygems/test_gem_request_set_lockfile.rb
index 0be69bf92b..9e0cab4d1a 100644
--- a/test/rubygems/test_gem_request_set_lockfile.rb
+++ b/test/rubygems/test_gem_request_set_lockfile.rb
@@ -218,7 +218,6 @@ GEM
c (~> 4)
d
e (~> 5.0, >= 5.0.1)
- b (3-x86_64-linux)
PLATFORMS
#{Gem::Platform::RUBY}
@@ -239,14 +238,7 @@ DEPENDENCIES
assert lockfile_set, 'could not find a LockSet'
- assert_equal %w[a-2 b-3], lockfile_set.specs.map { |tuple| tuple.full_name }
-
- expected = [
- Gem::Platform::RUBY,
- Gem::Platform.new('x86_64-linux'),
- ]
-
- assert_equal expected, lockfile_set.specs.map { |tuple| tuple.platform }
+ assert_equal %w[a-2], lockfile_set.specs.map { |tuple| tuple.full_name }
spec = lockfile_set.specs.first
diff --git a/test/rubygems/test_gem_specification.rb b/test/rubygems/test_gem_specification.rb
index b72a5d1baf..7aa9d5aeb1 100644
--- a/test/rubygems/test_gem_specification.rb
+++ b/test/rubygems/test_gem_specification.rb
@@ -999,8 +999,8 @@ dependencies: []
assert_equal 'summary', spec.summary
assert_same spec.summary, new_spec.summary
- assert_equal %w[README.txt bin/exec ext/extconf.rb lib/file.rb
- test/file.rb].sort,
+ assert_equal %w[lib/file.rb test/file.rb bin/exec README.txt
+ ext/extconf.rb].sort,
spec.files
refute_same spec.files, new_spec.files, 'files'
@@ -1109,31 +1109,7 @@ dependencies: []
@a2.executable = 'app'
assert_equal nil, @a2.bindir
- assert_equal %w[app lib/code.rb].sort, @a2.files
- end
-
- def test_extensions_equals_nil
- @a2.instance_variable_set(:@extensions, nil)
- assert_equal nil, @a2.instance_variable_get(:@extensions)
- assert_equal %w[lib/code.rb], @a2.files
- end
-
- def test_test_files_equals_nil
- @a2.instance_variable_set(:@test_files, nil)
- assert_equal nil, @a2.instance_variable_get(:@test_files)
- assert_equal %w[lib/code.rb], @a2.files
- end
-
- def test_executables_equals_nil
- @a2.instance_variable_set(:@executables, nil)
- assert_equal nil, @a2.instance_variable_get(:@executables)
- assert_equal %w[lib/code.rb], @a2.files
- end
-
- def test_extra_rdoc_files_equals_nil
- @a2.instance_variable_set(:@extra_rdoc_files, nil)
- assert_equal nil, @a2.instance_variable_get(:@extra_rdoc_files)
- assert_equal %w[lib/code.rb], @a2.files
+ assert_equal %w[lib/code.rb app].sort, @a2.files
end
def test_build_extensions
@@ -1461,7 +1437,7 @@ dependencies: []
def test_executable_equals
@a2.executable = 'app'
assert_equal 'app', @a2.executable
- assert_equal %w[bin/app lib/code.rb].sort, @a2.files
+ assert_equal %w[lib/code.rb bin/app].sort, @a2.files
end
def test_extensions
@@ -1809,22 +1785,6 @@ dependencies: []
assert_kind_of Gem::Source::Installed, @a1.source
end
- def test_source_paths
- ext_spec
-
- @ext.require_paths = %w[lib ext foo]
- @ext.extensions << 'bar/baz'
-
- expected = %w[
- lib
- ext
- foo
- bar
- ]
-
- assert_equal expected, @ext.source_paths
- end
-
def test_full_require_paths
ext_spec
@@ -2475,7 +2435,7 @@ duplicate dependency on b (>= 1.2.3), (~> 1.2) use:
assert_equal '["lib2"] are not files', e.message
end
- assert_equal %w[bin/exec ext/a/extconf.rb lib/code.rb lib2 test/suite.rb].sort,
+ assert_equal %w[lib/code.rb test/suite.rb bin/exec ext/a/extconf.rb lib2].sort,
@a1.files
end
diff --git a/test/rubygems/test_gem_uninstaller.rb b/test/rubygems/test_gem_uninstaller.rb
index 11fdaf68e2..1eea30fb94 100644
--- a/test/rubygems/test_gem_uninstaller.rb
+++ b/test/rubygems/test_gem_uninstaller.rb
@@ -131,23 +131,6 @@ class TestGemUninstaller < Gem::InstallerTestCase
Gem::Installer.exec_format = nil
end
- def test_remove_not_in_home
- uninstaller = Gem::Uninstaller.new nil, :install_dir => "#{@gemhome}2"
-
- e = assert_raises Gem::GemNotInHomeException do
- use_ui ui do
- uninstaller.remove @spec
- end
- end
-
- expected =
- "Gem '#{@spec.full_name}' is not installed in directory #{@gemhome}2"
-
- assert_equal expected, e.message
-
- assert_path_exists @spec.gem_dir
- end
-
def test_path_ok_eh
uninstaller = Gem::Uninstaller.new nil
diff --git a/version.h b/version.h
index 8553f79047..c361122024 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@
#define RUBY_VERSION "2.1.1"
#define RUBY_RELEASE_DATE "2014-01-31"
-#define RUBY_PATCHLEVEL 14
+#define RUBY_PATCHLEVEL 13
#define RUBY_RELEASE_YEAR 2014
#define RUBY_RELEASE_MONTH 1