[前][次][番号順一覧][スレッド一覧]

ruby-changes:35666

From: drbrain <ko1@a...>
Date: Wed, 1 Oct 2014 17:30:45 +0900 (JST)
Subject: [ruby-changes:35666] drbrain:r47748 (trunk): * lib/rubygems: Update to RubyGems 2.4.2.

drbrain	2014-10-01 17:30:21 +0900 (Wed, 01 Oct 2014)

  New Revision: 47748

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=47748

  Log:
    * lib/rubygems:  Update to RubyGems 2.4.2.
    * test/rubygems:  ditto.

  Modified files:
    trunk/ChangeLog
    trunk/lib/rubygems/commands/update_command.rb
    trunk/lib/rubygems/installer.rb
    trunk/lib/rubygems/request_set/gem_dependency_api.rb
    trunk/lib/rubygems/request_set/lockfile.rb
    trunk/lib/rubygems/request_set.rb
    trunk/lib/rubygems/source/git.rb
    trunk/lib/rubygems.rb
    trunk/test/rubygems/test_gem_commands_update_command.rb
    trunk/test/rubygems/test_gem_request_set_gem_dependency_api.rb
    trunk/test/rubygems/test_gem_request_set_lockfile.rb
    trunk/test/rubygems/test_gem_source_git.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 47747)
+++ ChangeLog	(revision 47748)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Oct  1 17:28:58 2014 Eric Hodel  <drbrain@s...>
+
+	* lib/rubygems:  Update to RubyGems 2.4.2.
+	* test/rubygems:  ditto.
+
 Tue Sep 30 22:25:32 2014  Nobuyoshi Nakada  <nobu@r...>
 
 	* parse.y (parser_data_type): separate ripper data type for from
Index: lib/rubygems/request_set.rb
===================================================================
--- lib/rubygems/request_set.rb	(revision 47747)
+++ lib/rubygems/request_set.rb	(revision 47748)
@@ -284,6 +284,48 @@ class Gem::RequestSet https://github.com/ruby/ruby/blob/trunk/lib/rubygems/request_set.rb#L284
     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.
Index: lib/rubygems/source/git.rb
===================================================================
--- lib/rubygems/source/git.rb	(revision 47747)
+++ lib/rubygems/source/git.rb	(revision 47748)
@@ -178,9 +178,17 @@ class Gem::Source::Git < Gem::Source https://github.com/ruby/ruby/blob/trunk/lib/rubygems/source/git.rb#L178
   # 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
 
   ##
Index: lib/rubygems/commands/update_command.rb
===================================================================
--- lib/rubygems/commands/update_command.rb	(revision 47747)
+++ lib/rubygems/commands/update_command.rb	(revision 47748)
@@ -203,7 +203,10 @@ command to remove old versions. https://github.com/ruby/ruby/blob/trunk/lib/rubygems/commands/update_command.rb#L203
   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
Index: lib/rubygems/request_set/gem_dependency_api.rb
===================================================================
--- lib/rubygems/request_set/gem_dependency_api.rb	(revision 47747)
+++ lib/rubygems/request_set/gem_dependency_api.rb	(revision 47748)
@@ -596,8 +596,17 @@ Gem dependencies file #{@path} requires https://github.com/ruby/ruby/blob/trunk/lib/rubygems/request_set/gem_dependency_api.rb#L596
 
     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
Index: lib/rubygems/request_set/lockfile.rb
===================================================================
--- lib/rubygems/request_set/lockfile.rb	(revision 47747)
+++ lib/rubygems/request_set/lockfile.rb	(revision 47748)
@@ -168,8 +168,12 @@ class Gem::RequestSet::Lockfile https://github.com/ruby/ruby/blob/trunk/lib/rubygems/request_set/lockfile.rb#L168
     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
Index: lib/rubygems/installer.rb
===================================================================
--- lib/rubygems/installer.rb	(revision 47747)
+++ lib/rubygems/installer.rb	(revision 47748)
@@ -681,14 +681,14 @@ TEXT https://github.com/ruby/ruby/blob/trunk/lib/rubygems/installer.rb#L681
   # 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
 
Index: lib/rubygems.rb
===================================================================
--- lib/rubygems.rb	(revision 47747)
+++ lib/rubygems.rb	(revision 47748)
@@ -9,7 +9,7 @@ require 'rbconfig' https://github.com/ruby/ruby/blob/trunk/lib/rubygems.rb#L9
 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
Index: test/rubygems/test_gem_request_set_lockfile.rb
===================================================================
--- test/rubygems/test_gem_request_set_lockfile.rb	(revision 47747)
+++ test/rubygems/test_gem_request_set_lockfile.rb	(revision 47748)
@@ -643,6 +643,16 @@ DEPENDENCIES https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_request_set_lockfile.rb#L643
     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]]
 
Index: test/rubygems/test_gem_source_git.rb
===================================================================
--- test/rubygems/test_gem_source_git.rb	(revision 47747)
+++ test/rubygems/test_gem_source_git.rb	(revision 47748)
@@ -180,6 +180,17 @@ class TestGemSourceGit < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_source_git.rb#L180
     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
Index: test/rubygems/test_gem_commands_update_command.rb
===================================================================
--- test/rubygems/test_gem_commands_update_command.rb	(revision 47747)
+++ test/rubygems/test_gem_commands_update_command.rb	(revision 47748)
@@ -485,6 +485,19 @@ class TestGemCommandsUpdateCommand < Gem https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_commands_update_command.rb#L485
     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
Index: test/rubygems/test_gem_request_set_gem_dependency_api.rb
===================================================================
--- test/rubygems/test_gem_request_set_gem_dependency_api.rb	(revision 47747)
+++ test/rubygems/test_gem_request_set_gem_dependency_api.rb	(revision 47748)
@@ -460,9 +460,18 @@ class TestGemRequestSetGemDependencyAPI https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_request_set_gem_dependency_api.rb#L460
 
     @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 https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_request_set_gem_dependency_api.rb#L498
 
     @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 https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_request_set_gem_dependency_api.rb#L534
 
     @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 https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_request_set_gem_dependency_api.rb#L546
 
     @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 https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_request_set_gem_dependency_api.rb#L568
 
     @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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]