mirror of
https://github.com/ruby/ruby.git
synced 2025-08-16 05:59:00 +02:00

That restores support for compact index dummy implementations that only lists
versions, without checksums or dependencies.
This format is undocumented, so we may want to get rid of it in the
future. However, some of our tests rely on it, and some implementations
did use it (gems.mutant.dev at least). And the way the code was written
suggest that support was intentional.
So for now, we should restore it.
0427d8c983
21 lines
718 B
Ruby
21 lines
718 B
Ruby
# frozen_string_literal: true
|
|
|
|
class Gem::Resolver::APISet::GemParser
|
|
def parse(line)
|
|
version_and_platform, rest = line.split(" ", 2)
|
|
version, platform = version_and_platform.split("-", 2)
|
|
dependencies, requirements = rest.split("|", 2).map! {|s| s.split(",") } if rest
|
|
dependencies = dependencies ? dependencies.map! {|d| parse_dependency(d) } : []
|
|
requirements = requirements ? requirements.map! {|d| parse_dependency(d) } : []
|
|
[version, platform, dependencies, requirements]
|
|
end
|
|
|
|
private
|
|
|
|
def parse_dependency(string)
|
|
dependency = string.split(":")
|
|
dependency[-1] = dependency[-1].split("&") if dependency.size > 1
|
|
dependency[0] = -dependency[0]
|
|
dependency
|
|
end
|
|
end
|