ruby-changes:70016
From: David <ko1@a...>
Date: Thu, 2 Dec 2021 18:10:48 +0900 (JST)
Subject: [ruby-changes:70016] cf88271331 (master): [rubygems/rubygems] Fix gemspec source unlocking also for prereleases like 0.0.0.SNAPSHOT
https://git.ruby-lang.org/ruby.git/commit/?id=cf88271331 From cf882713312576a827abff8ddf7eb620e1f3f6d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@r...> Date: Tue, 30 Nov 2021 18:07:32 +0100 Subject: [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". https://github.com/rubygems/rubygems/commit/711498b342 --- lib/bundler/lazy_specification.rb | 2 +- spec/bundler/install/gemfile/path_spec.rb | 33 +++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/lib/bundler/lazy_specification.rb b/lib/bundler/lazy_specification.rb index 012229f430c..104225e9ee7 100644 --- a/lib/bundler/lazy_specification.rb +++ b/lib/bundler/lazy_specification.rb @@ -39,7 +39,7 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/lazy_specification.rb#L39 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 diff --git a/spec/bundler/install/gemfile/path_spec.rb b/spec/bundler/install/gemfile/path_spec.rb index db5db31d42d..bea7c11dec2 100644 --- a/spec/bundler/install/gemfile/path_spec.rb +++ b/spec/bundler/install/gemfile/path_spec.rb @@ -216,6 +216,39 @@ RSpec.describe "bundle install with explicit source paths" do https://github.com/ruby/ruby/blob/trunk/spec/bundler/install/gemfile/path_spec.rb#L216 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") -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/