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

ruby-changes:31268

From: drbrain <ko1@a...>
Date: Fri, 18 Oct 2013 09:41:44 +0900 (JST)
Subject: [ruby-changes:31268] drbrain:r43347 (trunk): * lib/rubygems: Update to RubyGems master cee6788. Changes:

drbrain	2013-10-18 09:41:36 +0900 (Fri, 18 Oct 2013)

  New Revision: 43347

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

  Log:
    * lib/rubygems:  Update to RubyGems master cee6788.  Changes:
    
      Fix test failure on vc10-x64 Server on rubyci.org due to attempting
      to File.chmod where it is not supported.
    
      Continuing work on improved gem dependencies file (Gemfile) support.
    
    * test:  ditto.

  Modified files:
    trunk/ChangeLog
    trunk/lib/rubygems/dependency_installer.rb
    trunk/lib/rubygems/dependency_resolver/installer_set.rb
    trunk/lib/rubygems/dependency_resolver.rb
    trunk/lib/rubygems/request_set/gem_dependency_api.rb
    trunk/lib/rubygems/request_set.rb
    trunk/lib/rubygems/source.rb
    trunk/lib/rubygems/test_case.rb
    trunk/test/rubygems/test_gem_request_set.rb
    trunk/test/rubygems/test_gem_request_set_gem_dependency_api.rb
    trunk/test/rubygems/test_gem_specification.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 43346)
+++ ChangeLog	(revision 43347)
@@ -1,3 +1,14 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Oct 18 09:40:43 2013  Eric Hodel  <drbrain@s...>
+
+	* lib/rubygems:  Update to RubyGems master cee6788.  Changes:
+
+	  Fix test failure on vc10-x64 Server on rubyci.org due to attempting
+	  to File.chmod where it is not supported.
+
+	  Continuing work on improved gem dependencies file (Gemfile) support.
+
+	* test:  ditto.
+
 Fri Oct 18 06:02:49 2013  Eric Hodel  <drbrain@s...>
 
 	* lib/rubygems:  Update to RubyGems master f738c67.  Changes:
Index: lib/rubygems/dependency_installer.rb
===================================================================
--- lib/rubygems/dependency_installer.rb	(revision 43346)
+++ lib/rubygems/dependency_installer.rb	(revision 43347)
@@ -278,7 +278,7 @@ class Gem::DependencyInstaller https://github.com/ruby/ruby/blob/trunk/lib/rubygems/dependency_installer.rb#L278
   # Gathers all dependencies necessary for the installation from local and
   # remote sources unless the ignore_dependencies was given.
   #--
-  # TODO remove, no longer used
+  # TODO remove at RubyGems 3
 
   def gather_dependencies # :nodoc:
     specs = @available.all_specs
Index: lib/rubygems/dependency_resolver/installer_set.rb
===================================================================
--- lib/rubygems/dependency_resolver/installer_set.rb	(revision 43346)
+++ lib/rubygems/dependency_resolver/installer_set.rb	(revision 43347)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/lib/rubygems/dependency_resolver/installer_set.rb#L1
+##
+# A set of gems for installation sourced from remote sources and local .gem
+# files
+
 class Gem::DependencyResolver::InstallerSet
 
   ##
Index: lib/rubygems/request_set.rb
===================================================================
--- lib/rubygems/request_set.rb	(revision 43346)
+++ lib/rubygems/request_set.rb	(revision 43347)
@@ -37,6 +37,11 @@ class Gem::RequestSet https://github.com/ruby/ruby/blob/trunk/lib/rubygems/request_set.rb#L37
   attr_accessor :soft_missing
 
   ##
+  # The set of vendor gems imported via load_gemdeps.
+
+  attr_reader :vendor_set # :nodoc:
+
+  ##
   # Creates a RequestSet for a list of Gem::Dependency objects, +deps+.  You
   # can then #resolve and #install the resolved list of dependencies.
   #
@@ -54,6 +59,7 @@ class Gem::RequestSet https://github.com/ruby/ruby/blob/trunk/lib/rubygems/request_set.rb#L59
     @soft_missing   = false
     @sorted         = nil
     @specs          = nil
+    @vendor_set     = nil
 
     yield self if block_given?
   end
@@ -69,7 +75,7 @@ class Gem::RequestSet https://github.com/ruby/ruby/blob/trunk/lib/rubygems/request_set.rb#L75
   # Add +deps+ Gem::Dependency objects to the set.
 
   def import deps
-    @dependencies += deps
+    @dependencies.concat deps
   end
 
   def install options, &block
@@ -143,6 +149,8 @@ class Gem::RequestSet https://github.com/ruby/ruby/blob/trunk/lib/rubygems/request_set.rb#L149
   # Load a dependency management file.
 
   def load_gemdeps path
+    @vendor_set = Gem::DependencyResolver::VendorSet.new
+
     gf = Gem::RequestSet::GemDependencyAPI.new self, path
     gf.load
   end
Index: lib/rubygems/dependency_resolver.rb
===================================================================
--- lib/rubygems/dependency_resolver.rb	(revision 43346)
+++ lib/rubygems/dependency_resolver.rb	(revision 43347)
@@ -43,10 +43,10 @@ class Gem::DependencyResolver https://github.com/ruby/ruby/blob/trunk/lib/rubygems/dependency_resolver.rb#L43
 
   ##
   # Create DependencyResolver object which will resolve the tree starting
-  # with +needed+ Depedency objects.
+  # with +needed+ Dependency objects.
   #
   # +set+ is an object that provides where to look for specifications to
-  # satisify the Dependencies. This defaults to IndexSet, which will query
+  # satisfy the Dependencies. This defaults to IndexSet, which will query
   # rubygems.org.
 
   def initialize needed, set = nil
@@ -119,15 +119,12 @@ class Gem::DependencyResolver https://github.com/ruby/ruby/blob/trunk/lib/rubygems/dependency_resolver.rb#L119
   end
 
   def handle_conflict(dep, existing)
-    # There is a conflict! We return the conflict
-    # object which will be seen by the caller and be
-    # handled at the right level.
-
-    # If the existing activation indicates that there
-    # are other possibles for it, then issue the conflict
-    # on the dep for the activation itself. Otherwise, issue
-    # it on the requester's request itself.
-    #
+    # There is a conflict! We return the conflict object which will be seen by
+    # the caller and be handled at the right level.
+
+    # If the existing activation indicates that there are other possibles for
+    # it, then issue the conflict on the dependency for the activation itself.
+    # Otherwise, issue it on the requester's request itself.
     if existing.others_possible?
       conflict =
         Gem::DependencyResolver::DependencyConflict.new dep, existing
@@ -146,7 +143,7 @@ class Gem::DependencyResolver https://github.com/ruby/ruby/blob/trunk/lib/rubygems/dependency_resolver.rb#L143
   # +needed+ is a Gem::List of DependencyRequest objects that, well, need
   # to be satisfied.
   # +specs+ is the List of ActivationRequest that are being tested.
-  # +dep+ is the DepedencyRequest that was used to generate this state.
+  # +dep+ is the DependencyRequest that was used to generate this state.
   # +spec+ is the Specification for this state.
   # +possible+ is List of DependencyRequest objects that can be tried to
   # find a  complete set.
@@ -307,4 +304,6 @@ require 'rubygems/dependency_resolver/in https://github.com/ruby/ruby/blob/trunk/lib/rubygems/dependency_resolver.rb#L304
 require 'rubygems/dependency_resolver/index_specification'
 require 'rubygems/dependency_resolver/installed_specification'
 require 'rubygems/dependency_resolver/installer_set'
+require 'rubygems/dependency_resolver/vendor_set'
+require 'rubygems/dependency_resolver/vendor_specification'
 
Index: lib/rubygems/source.rb
===================================================================
--- lib/rubygems/source.rb	(revision 43346)
+++ lib/rubygems/source.rb	(revision 43347)
@@ -162,3 +162,5 @@ end https://github.com/ruby/ruby/blob/trunk/lib/rubygems/source.rb#L162
 require 'rubygems/source/installed'
 require 'rubygems/source/specific_file'
 require 'rubygems/source/local'
+require 'rubygems/source/vendor'
+
Index: lib/rubygems/request_set/gem_dependency_api.rb
===================================================================
--- lib/rubygems/request_set/gem_dependency_api.rb	(revision 43346)
+++ lib/rubygems/request_set/gem_dependency_api.rb	(revision 43347)
@@ -9,6 +9,11 @@ class Gem::RequestSet::GemDependencyAPI https://github.com/ruby/ruby/blob/trunk/lib/rubygems/request_set/gem_dependency_api.rb#L9
   attr_reader :dependency_groups
 
   ##
+  # A set of gems that are loaded via the +:path+ option to #gem
+
+  attr_reader :vendor_set # :nodoc:
+
+  ##
   # Creates a new GemDependencyAPI that will add dependencies to the
   # Gem::RequestSet +set+ based on the dependency API description in +path+.
 
@@ -18,6 +23,7 @@ class Gem::RequestSet::GemDependencyAPI https://github.com/ruby/ruby/blob/trunk/lib/rubygems/request_set/gem_dependency_api.rb#L23
 
     @current_groups    = nil
     @dependency_groups = Hash.new { |h, group| h[group] = [] }
+    @vendor_set        = @set.vendor_set
   end
 
   ##
@@ -41,13 +47,20 @@ class Gem::RequestSet::GemDependencyAPI https://github.com/ruby/ruby/blob/trunk/lib/rubygems/request_set/gem_dependency_api.rb#L47
     options = requirements.pop if requirements.last.kind_of?(Hash)
     options ||= {}
 
-    groups =
-      (group = options.delete(:group) and Array(group)) ||
-      options.delete(:groups) ||
-      @current_groups
+    if directory = options.delete(:path) then
+      @vendor_set.add_vendor_gem name, directory
+    end
+
+    group = options.delete :group
+    all_groups  = group ? Array(group) : []
+
+    groups = options.delete :groups
+    all_groups |= groups if groups
+
+    all_groups |= @current_groups if @current_groups
 
-    if groups then
-      groups.each do |group|
+    unless all_groups.empty? then
+      all_groups.each do |group|
         gem_arguments = [name, *requirements]
         gem_arguments << options unless options.empty?
         @dependency_groups[group] << gem_arguments
Index: lib/rubygems/test_case.rb
===================================================================
--- lib/rubygems/test_case.rb	(revision 43346)
+++ lib/rubygems/test_case.rb	(revision 43347)
@@ -1095,6 +1095,24 @@ Also, a list: https://github.com/ruby/ruby/blob/trunk/lib/rubygems/test_case.rb#L1095
     Gem::Version.create string
   end
 
+  ##
+  # A vendor_gem is used with a gem dependencies file.  The gem created here
+  # has no files, just a gem specification for the given +name+ and +version+.
+
+  def vendor_gem name = 'a', version = 1
+    directory = File.join 'vendor', name
+
+    vendor_spec = Gem::Specification.new name, version
+
+    FileUtils.mkdir_p directory
+
+    open File.join(directory, "#{name}.gemspec"), 'w' do |io|
+      io.write vendor_spec.to_ruby
+    end
+
+    return name, vendor_spec.version, directory
+  end
+
   class StaticSet
     def initialize(specs)
       @specs = specs
Index: test/rubygems/test_gem_request_set.rb
===================================================================
--- test/rubygems/test_gem_request_set.rb	(revision 43346)
+++ test/rubygems/test_gem_request_set.rb	(revision 43347)
@@ -17,6 +17,30 @@ class TestGemRequestSet < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_request_set.rb#L17
     assert_equal [Gem::Dependency.new("a", "=2")], rs.dependencies
   end
 
+  def test_import
+    rs = Gem::RequestSet.new
+    rs.gem 'a'
+
+    rs.import [dep('b')]
+
+    assert_equal [dep('a'), dep('b')], rs.dependencies
+  end
+
+  def test_load_gemdeps
+    rs = Gem::RequestSet.new
+
+    Tempfile.open 'gem.deps.rb' do |io|
+      io.puts 'gem "a"'
+      io.flush
+
+      rs.load_gemdeps io.path
+    end
+
+    assert_equal [dep('a')], rs.dependencies
+
+    assert rs.vendor_set
+  end
+
   def test_resolve
     a = util_spec "a", "2", "b" => ">= 2"
     b = util_spec "b", "2"
Index: test/rubygems/test_gem_specification.rb
===================================================================
--- test/rubygems/test_gem_specification.rb	(revision 43346)
+++ test/rubygems/test_gem_specification.rb	(revision 43347)
@@ -1175,8 +1175,10 @@ dependencies: [] https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_specification.rb#L1175
       @ext.build_extensions
     end
   ensure
-    FileUtils.chmod 0755, File.join(@ext.base_dir, 'extensions')
-    FileUtils.chmod 0755, @ext.base_dir
+    unless Gem.win_platform? then
+      FileUtils.chmod 0755, File.join(@ext.base_dir, 'extensions')
+      FileUtils.chmod 0755, @ext.base_dir
+    end
   end
 
   def test_build_extensions_no_extensions_dir_unwritable
Index: test/rubygems/test_gem_request_set_gem_dependency_api.rb
===================================================================
--- test/rubygems/test_gem_request_set_gem_dependency_api.rb	(revision 43346)
+++ test/rubygems/test_gem_request_set_gem_dependency_api.rb	(revision 43347)
@@ -10,7 +10,10 @@ class TestGemRequestSetGemDependencyAPI https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_request_set_gem_dependency_api.rb#L10
 
     @set = Gem::RequestSet.new
 
+    @vendor_set = Gem::DependencyResolver::VendorSet.new
+
     @gda = @GDA.new @set, 'gem.deps.rb'
+    @gda.instance_variable_set :@vendor_set, @vendor_set
   end
 
   def test_gem
@@ -44,6 +47,18 @@ class TestGemRequestSetGemDependencyAPI https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_request_set_gem_dependency_api.rb#L47
     assert_empty @set.dependencies
   end
 
+  def test_gem_path
+    name, version, directory = vendor_gem
+
+    @gda.gem name, :path => directory
+
+    assert_equal [dep(name)], @set.dependencies
+
+    loaded = @vendor_set.load_spec(name, version, Gem::Platform::RUBY, nil)
+
+    assert_equal "#{name}-#{version}", loaded.full_name
+  end
+
   def test_gem_requirement
     @gda.gem 'a', '~> 1.0'
 
@@ -80,6 +95,17 @@ class TestGemRequestSetGemDependencyAPI https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_request_set_gem_dependency_api.rb#L95
     assert_empty @set.dependencies
   end
 
+  def test_group_multiple
+    @gda.group :a do
+      @gda.gem 'a', :group => :b, :groups => [:c, :d]
+    end
+
+    assert_equal [['a']], @gda.dependency_groups[:a]
+    assert_equal [['a']], @gda.dependency_groups[:b]
+    assert_equal [['a']], @gda.dependency_groups[:c]
+    assert_equal [['a']], @gda.dependency_groups[:d]
+  end
+
   def test_load
     Tempfile.open 'gem.deps.rb' do |io|
       io.write <<-GEM_DEPS

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

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