1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44081 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
drbrain 2013-12-08 19:32:07 +00:00
parent fe57c5d49e
commit da3e610adf
6 changed files with 98 additions and 14 deletions

View file

@ -1,3 +1,9 @@
Mon Dec 9 04:28:50 2013 Eric Hodel <drbrain@segment7.net>
* 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@ruby-lang.org>
* lib/net/http/responses.rb:

View file

@ -1103,7 +1103,7 @@ module Gem
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

View file

@ -222,6 +222,8 @@ class Gem::RequestSet::Lockfile
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
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
@ -366,6 +369,49 @@ class Gem::RequestSet::Lockfile
@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
get :r_paren
else
raise "BUG: unknown token #{peek}"
end
skip :newline
end
@set.sets << set
end
def parse_PLATFORMS # :nodoc:
while not @tokens.empty? and :text == peek.first do
_, name, = get :text

View file

@ -15,6 +15,11 @@
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::Resolver::Set
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::Resolver::Set
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:

View file

@ -176,6 +176,38 @@ DEPENDENCIES
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

View file

@ -59,7 +59,7 @@ class TestGemResolverVendorSet < Gem::TestCase
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