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

[rubygems/rubygems] Fix gemspec source unlocking also for prereleases like 0.0.0.SNAPSHOT

The default prerelease requirement in rubygems doesn't actually match
things like "0.0.0.SNAPSHOT".

711498b342
This commit is contained in:
David Rodríguez 2021-11-30 18:07:32 +01:00 committed by git
parent 2a15b28a9e
commit cf88271331
2 changed files with 34 additions and 1 deletions

View file

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

View file

@ -216,6 +216,39 @@ RSpec.describe "bundle install with explicit source paths" do
expect(the_bundle).to include_gems "foo 0.0.0.dev"
end
it "works when using uppercase prereleases of 0.0.0" do
build_lib "foo", "0.0.0.SNAPSHOT", :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.SNAPSHOT)
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.SNAPSHOT"
end
it "handles downgrades" do
build_lib "omg", "2.0", :path => lib_path("omg")