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

ruby-changes:32002

From: drbrain <ko1@a...>
Date: Mon, 9 Dec 2013 04:32:15 +0900 (JST)
Subject: [ruby-changes:32002] drbrain:r44081 (trunk): * lib/rubygems: Update to RubyGems master 096db36. Changes include

drbrain	2013-12-09 04:32:07 +0900 (Mon, 09 Dec 2013)

  New Revision: 44081

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

  Log:
    * lib/rubygems:  Update to RubyGems master 096db36.  Changes include
      support for PATH in Gemfile.lock and a typo fix from Akira Matsuda.
    * test/rubygems:  ditto.

  Modified files:
    trunk/ChangeLog
    trunk/lib/rubygems/request_set/lockfile.rb
    trunk/lib/rubygems/resolver/vendor_set.rb
    trunk/lib/rubygems.rb
    trunk/test/rubygems/test_gem_request_set_lockfile.rb
    trunk/test/rubygems/test_gem_resolver_vendor_set.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 44080)
+++ ChangeLog	(revision 44081)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon Dec  9 04:28:50 2013  Eric Hodel  <drbrain@s...>
+
+	* lib/rubygems:  Update to RubyGems master 096db36.  Changes include
+	  support for PATH in Gemfile.lock and a typo fix from Akira Matsuda.
+	* test/rubygems:  ditto.
+
 Mon Dec  9 02:10:32 2013  NARUSE, Yui  <naruse@r...>
 
 	* lib/net/http/responses.rb:
Index: lib/rubygems/request_set/lockfile.rb
===================================================================
--- lib/rubygems/request_set/lockfile.rb	(revision 44080)
+++ lib/rubygems/request_set/lockfile.rb	(revision 44081)
@@ -222,6 +222,8 @@ class Gem::RequestSet::Lockfile https://github.com/ruby/ruby/blob/trunk/lib/rubygems/request_set/lockfile.rb#L222
           parse_GIT
         when 'GEM' then
           parse_GEM
+        when 'PATH' then
+          parse_PATH
         when 'PLATFORMS' then
           parse_PLATFORMS
         else
@@ -243,13 +245,14 @@ class Gem::RequestSet::Lockfile https://github.com/ruby/ruby/blob/trunk/lib/rubygems/request_set/lockfile.rb#L245
       when :bang then
         get :bang
 
-        git_spec = @set.sets.select { |set|
-          Gem::Resolver::GitSet === set
+        spec = @set.sets.select { |set|
+          Gem::Resolver::GitSet    === set or
+          Gem::Resolver::VendorSet === set
         }.map { |set|
           set.specs[name]
         }.first
 
-        requirements << git_spec.version
+        requirements << spec.version
       when :l_paren then
         get :l_paren
 
@@ -352,6 +355,49 @@ class Gem::RequestSet::Lockfile https://github.com/ruby/ruby/blob/trunk/lib/rubygems/request_set/lockfile.rb#L355
         else
           dependency = parse_dependency name, data
 
+          last_spec.spec.dependencies << dependency
+        end
+
+        get :r_paren
+      else
+        raise "BUG: unknown token #{peek}"
+      end
+
+      skip :newline
+    end
+
+    @set.sets << set
+  end
+
+  def parse_PATH # :nodoc:
+    get :entry, 'remote'
+    _, directory, = get :text
+
+    skip :newline
+
+    get :entry, 'specs'
+
+    skip :newline
+
+    set = Gem::Resolver::VendorSet.new
+    last_spec = nil
+
+    while not @tokens.empty? and :text == peek.first do
+      _, name, column, = get :text
+
+      case peek[0]
+      when :newline then
+        last_spec.add_dependency Gem::Dependency.new name if column == 6
+      when :l_paren then
+        get :l_paren
+
+        type, data, = get [:text, :requirement]
+
+        if type == :text and column == 4 then
+          last_spec = set.add_vendor_gem name, directory
+        else
+          dependency = parse_dependency name, data
+
           last_spec.spec.dependencies << dependency
         end
 
Index: lib/rubygems/resolver/vendor_set.rb
===================================================================
--- lib/rubygems/resolver/vendor_set.rb	(revision 44080)
+++ lib/rubygems/resolver/vendor_set.rb	(revision 44081)
@@ -15,6 +15,11 @@ https://github.com/ruby/ruby/blob/trunk/lib/rubygems/resolver/vendor_set.rb#L15
 
 class Gem::Resolver::VendorSet < Gem::Resolver::Set
 
+  ##
+  # The specifications for this set.
+
+  attr_reader :specs # :nodoc:
+
   def initialize # :nodoc:
     @directories = {}
     @specs       = {}
@@ -34,9 +39,7 @@ class Gem::Resolver::VendorSet < Gem::Re https://github.com/ruby/ruby/blob/trunk/lib/rubygems/resolver/vendor_set.rb#L39
 
     spec.full_gem_path = File.expand_path directory
 
-    key = "#{spec.name}-#{spec.version}-#{spec.platform}"
-
-    @specs[key]        = spec
+    @specs[spec.name]  = spec
     @directories[spec] = directory
   end
 
@@ -54,14 +57,11 @@ class Gem::Resolver::VendorSet < Gem::Re https://github.com/ruby/ruby/blob/trunk/lib/rubygems/resolver/vendor_set.rb#L57
   end
 
   ##
-  # Loads a spec with the given +name+, +version+ and +platform+.  Since the
-  # +source+ is defined when the specification was added to index it is not
-  # used.
+  # Loads a spec with the given +name+. +version+, +platform+ and +source+ are
+  # ignored.
 
   def load_spec name, version, platform, source # :nodoc:
-    key = "#{name}-#{version}-#{platform}"
-
-    @specs.fetch key
+    @specs.fetch name
   end
 
   def pretty_print q # :nodoc:
Index: lib/rubygems.rb
===================================================================
--- lib/rubygems.rb	(revision 44080)
+++ lib/rubygems.rb	(revision 44081)
@@ -1103,7 +1103,7 @@ module Gem https://github.com/ruby/ruby/blob/trunk/lib/rubygems.rb#L1103
     end
 
     ##
-    # Clear default gem related varibles. It is for test
+    # Clear default gem related variables. It is for test
 
     def clear_default_specs
       @path_to_default_spec_map.clear
Index: test/rubygems/test_gem_resolver_vendor_set.rb
===================================================================
--- test/rubygems/test_gem_resolver_vendor_set.rb	(revision 44080)
+++ test/rubygems/test_gem_resolver_vendor_set.rb	(revision 44081)
@@ -59,7 +59,7 @@ class TestGemResolverVendorSet < Gem::Te https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_resolver_vendor_set.rb#L59
     error = Object.const_defined?(:KeyError) ? KeyError : IndexError
 
     assert_raises error do
-      @set.load_spec 'a', v(1), Gem::Platform::RUBY, nil
+      @set.load_spec 'b', v(1), Gem::Platform::RUBY, nil
     end
   end
 
Index: test/rubygems/test_gem_request_set_lockfile.rb
===================================================================
--- test/rubygems/test_gem_request_set_lockfile.rb	(revision 44080)
+++ test/rubygems/test_gem_request_set_lockfile.rb	(revision 44081)
@@ -176,6 +176,38 @@ DEPENDENCIES https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_request_set_lockfile.rb#L176
     assert_equal [dep('b', '>= 3')], git_set.specs.values.first.dependencies
   end
 
+  def test_parse_PATH
+    _, _, directory = vendor_gem
+
+    write_lockfile <<-LOCKFILE
+PATH
+  remote: #{directory}
+  specs:
+    a (1)
+
+DEPENDENCIES
+  a!
+    LOCKFILE
+
+    @lockfile.parse
+
+    assert_equal [dep('a', '= 1')], @set.dependencies
+
+    lockfile_set = @set.sets.find do |set|
+      Gem::Resolver::LockSet === set
+    end
+
+    refute lockfile_set, 'found a LockSet'
+
+    vendor_set = @set.sets.find do |set|
+      Gem::Resolver::VendorSet === set
+    end
+
+    assert vendor_set, 'could not find a VendorSet'
+
+    assert_equal %w[a-1], vendor_set.specs.values.map { |s| s.full_name }
+  end
+
   def test_parse_gem_specs_dependency
     write_lockfile <<-LOCKFILE
 GEM

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

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