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

[rubygems/rubygems] fix platform matching for index specs

https://github.com/rubygems/rubygems/commit/f087f1b590
This commit is contained in:
Ilya Dyakonov 2022-08-01 09:54:21 +01:00 committed by git
parent 20936eb3a9
commit 4f00ee8d47
3 changed files with 17 additions and 3 deletions

View file

@ -21,7 +21,8 @@ class Gem::Resolver::IndexSpecification < Gem::Resolver::Specification
@name = name
@version = version
@source = source
@platform = platform.to_s
@platform = Gem::Platform.new(platform.to_s)
@original_platform = platform.to_s
@spec = nil
end
@ -91,7 +92,7 @@ class Gem::Resolver::IndexSpecification < Gem::Resolver::Specification
def spec # :nodoc:
@spec ||=
begin
tuple = Gem::NameTuple.new @name, @version, @platform
tuple = Gem::NameTuple.new @name, @version, @original_platform
@source.fetch_spec tuple
end

View file

@ -26,7 +26,7 @@ class TestGemResolverIndexSpecification < Gem::TestCase
spec = Gem::Resolver::IndexSpecification.new(
set, "rails", version, source, Gem::Platform.local)
assert_equal Gem::Platform.local.to_s, spec.platform
assert_equal Gem::Platform.local, spec.platform
end
def test_install

View file

@ -51,6 +51,19 @@ class TestGemResolverInstallerSet < Gem::TestCase
assert_equal %w[a-1], set.always_install.map {|s| s.full_name }
end
def test_add_always_install_index_spec_platform
a_1_local, a_1_local_gem = util_gem "a", 1 do |s|
s.platform = Gem::Platform.local
end
FileUtils.mv a_1_local_gem, @tempdir
set = Gem::Resolver::InstallerSet.new :both
set.add_always_install dep("a")
assert_equal [Gem::Platform.local], set.always_install.map {|s| s.platform }
end
def test_add_always_install_prerelease
spec_fetcher do |fetcher|
fetcher.gem "a", 1