* lib/rubygems: Update to RubyGems 2.4.2.

* test/rubygems:  ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47748 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
drbrain 2014-10-01 08:30:21 +00:00
parent ffe920d674
commit cec4f5a9e0
12 changed files with 127 additions and 13 deletions

View File

@ -1,3 +1,8 @@
Wed Oct 1 17:28:58 2014 Eric Hodel <drbrain@segment7.net>
* lib/rubygems: Update to RubyGems 2.4.2.
* test/rubygems: ditto.
Tue Sep 30 22:25:32 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
* parse.y (parser_data_type): separate ripper data type for from

View File

@ -9,7 +9,7 @@ require 'rbconfig'
require 'thread'
module Gem
VERSION = '2.4.1'
VERSION = '2.4.2'
end
# Must be first since it unloads the prelude from 1.9.2

View File

@ -203,7 +203,10 @@ command to remove old versions.
def update_gem name, version = Gem::Requirement.default
return if @updated.any? { |spec| spec.name == name }
@installer ||= Gem::DependencyInstaller.new options
update_options = options.dup
update_options[:prerelease] = version.prerelease?
@installer = Gem::DependencyInstaller.new update_options
say "Updating #{name}"
begin

View File

@ -681,14 +681,14 @@ TEXT
# return the stub script text used to launch the true Ruby script
def windows_stub_script(bindir, bin_file_name)
ruby = File.basename(Gem.ruby).chomp('"')
ruby = Gem.ruby.chomp('"').tr(File::SEPARATOR, "\\")
return <<-TEXT
@ECHO OFF
IF NOT "%~f0" == "~f0" GOTO :WinNT
@"#{bindir.tr(File::SEPARATOR, File::ALT_SEPARATOR)}\\#{ruby}" "#{File.join(bindir, bin_file_name)}" %1 %2 %3 %4 %5 %6 %7 %8 %9
@"#{ruby}" "#{File.join(bindir, bin_file_name)}" %1 %2 %3 %4 %5 %6 %7 %8 %9
GOTO :EOF
:WinNT
@"%~dp0#{ruby}" "%~dpn0" %*
@"#{ruby}" "%~dpn0" %*
TEXT
end

View File

@ -284,6 +284,48 @@ class Gem::RequestSet
gf.load
end
def pretty_print q # :nodoc:
q.group 2, '[RequestSet:', ']' do
q.breakable
if @remote then
q.text 'remote'
q.breakable
end
if @prerelease then
q.text 'prerelease'
q.breakable
end
if @development_shallow then
q.text 'shallow development'
q.breakable
elsif @development then
q.text 'development'
q.breakable
end
if @soft_missing then
q.text 'soft missing'
end
q.group 2, '[dependencies:', ']' do
q.breakable
@dependencies.map do |dep|
q.text dep.to_s
q.breakable
end
end
q.breakable
q.text 'sets:'
q.breakable
q.pp @sets.map { |set| set.class }
end
end
##
# Resolve the requested dependencies and return an Array of Specification
# objects to be activated.

View File

@ -596,8 +596,17 @@ Gem dependencies file #{@path} requires #{name} more than once.
groups = gem_group spec.name, {}
self_dep = Gem::Dependency.new spec.name, spec.version
add_dependencies groups, [self_dep]
add_dependencies groups, spec.runtime_dependencies
@dependencies[spec.name] = '!'
spec.dependencies.each do |dep|
@dependencies[dep.name] = dep.requirement
end
groups << development_group
add_dependencies groups, spec.development_dependencies

View File

@ -168,8 +168,12 @@ class Gem::RequestSet::Lockfile
dest = File.expand_path(dest)
base = File.expand_path(base)
if dest.index(base) == 0
return dest[base.size+1..-1]
if dest.index(base) == 0 then
offset = dest[base.size+1..-1]
return '.' unless offset
offset
else
dest
end

View File

@ -178,9 +178,17 @@ class Gem::Source::Git < Gem::Source
# Converts the git reference for the repository into a commit hash.
def rev_parse # :nodoc:
hash = nil
Dir.chdir repo_cache_dir do
Gem::Util.popen(@git, 'rev-parse', @reference).strip
hash = Gem::Util.popen(@git, 'rev-parse', @reference).strip
end
raise Gem::Exception,
"unable to find reference #{@reference} in #{@repository}" unless
$?.success?
hash
end
##

View File

@ -485,6 +485,19 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
assert_equal expected, @cmd.options
end
def test_update_gem_prerelease
spec_fetcher do |fetcher|
fetcher.spec 'a', '1.a'
fetcher.gem 'a', '1.b'
end
@cmd.update_gem 'a', Gem::Requirement.new('= 1.b')
refute_empty @cmd.updated
assert @cmd.installer.instance_variable_get :@prerelease
end
def test_update_gem_unresolved_dependency
spec_fetcher do |fetcher|
fetcher.spec 'a', 1

View File

@ -460,9 +460,18 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
@gda.gemspec
assert_equal [dep('b', '= 2'), dep('c', '=3')], @set.dependencies
assert_equal [dep('a', '= 1'), dep('b', '= 2'), dep('c', '=3')],
@set.dependencies
assert_equal %w[a], @gda.requires['a']
expected = {
'a' => '!',
'b' => req('= 2'),
'c' => req('= 3'),
}
assert_equal expected, @gda.dependencies
end
def test_gemspec_bad
@ -489,7 +498,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
@gda.gemspec :development_group => :other
assert_equal [dep('b', '= 2')], @set.dependencies
assert_equal [dep('a', '= 1'), dep('b', '= 2')], @set.dependencies
assert_equal %w[a], @gda.requires['a']
end
@ -525,7 +534,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
@gda.gemspec :name => 'b'
assert_equal [dep('c', '= 3')], @set.dependencies
assert_equal [dep('b', '= 2'), dep('c', '= 3')], @set.dependencies
end
def test_gemspec_named
@ -537,7 +546,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
@gda.gemspec
assert_equal [dep('b', '= 2')], @set.dependencies
assert_equal [dep('a', '= 1'), dep('b', '= 2')], @set.dependencies
end
def test_gemspec_none
@ -559,7 +568,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
@gda.gemspec :path => 'other'
assert_equal [dep('b', '= 2')], @set.dependencies
assert_equal [dep('a', '= 1'), dep('b', '= 2')], @set.dependencies
end
def test_git

View File

@ -643,6 +643,16 @@ DEPENDENCIES
assert_equal [:EOF], @lockfile.peek
end
def test_relative_path_from
path = @lockfile.relative_path_from '/foo', '/foo/bar'
assert_equal '/foo', path
path = @lockfile.relative_path_from '/foo', '/foo'
assert_equal '.', path
end
def test_skip
tokens = [[:token]]

View File

@ -180,6 +180,17 @@ class TestGemSourceGit < Gem::TestCase
source.cache
refute_equal master_head, source.rev_parse
source = Gem::Source::Git.new @name, @repository, 'nonexistent', false
source.cache
e = assert_raises Gem::Exception do
source.rev_parse
end
assert_equal "unable to find reference nonexistent in #{@repository}",
e.message
end
def test_root_dir