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

[rubygems/rubygems] Fix materialization of locked 0 prereleases

Since the default requirement in rubygems is ">= 0", it was failing to
match 0 prereleases. Changing the default globally to be ">= 0.a"
instead is a major refactoring that's quite tricky to make backwards
compatible, so I'm special casing this where needed for now to fix the
regression.

https://github.com/rubygems/rubygems/commit/68fe37937c
This commit is contained in:
David Rodríguez 2021-11-30 18:03:14 +01:00 committed by git
parent fe506d7945
commit 2a15b28a9e
2 changed files with 36 additions and 1 deletions

View file

@ -39,7 +39,9 @@ module Bundler
end
def satisfies?(dependency)
@name == dependency.name && dependency.requirement.satisfied_by?(Gem::Version.new(@version))
effective_requirement = dependency.requirement == Gem::Requirement.default ? Gem::Requirement.default_prerelease : dependency.requirement
@name == dependency.name && effective_requirement.satisfied_by?(Gem::Version.new(@version))
end
def to_lock

View file

@ -183,6 +183,39 @@ RSpec.describe "bundle install with explicit source paths" do
expect(the_bundle).to include_gems "foo 1.0"
end
it "works when using prereleases of 0.0.0" do
build_lib "foo", "0.0.0.dev", :path => lib_path("foo")
gemfile <<~G
source "#{file_uri_for(gem_repo1)}"
gem "foo", :path => "#{lib_path("foo")}"
G
lockfile <<~L
PATH
remote: #{lib_path("foo")}
specs:
foo (0.0.0.dev)
GEM
remote: #{file_uri_for(gem_repo1)}/
specs:
PLATFORMS
#{lockfile_platforms}
DEPENDENCIES
foo!
BUNDLED WITH
#{Bundler::VERSION}
L
bundle :install
expect(the_bundle).to include_gems "foo 0.0.0.dev"
end
it "handles downgrades" do
build_lib "omg", "2.0", :path => lib_path("omg")