[rubygems/rubygems] Fix inline mode with multiple sources

If we're in inline mode, Bundler first resolves using only local gems,
and if some gems are missing, then it re-resolves using remote gems.
However, "source resolution" from the initial "local" try was being
memoized, resulting in Bundler not looking for some gems remotely in the
second resolution.

This commit forces a proper re-resolve in this case.

https://github.com/rubygems/rubygems/commit/fdc631075e
This commit is contained in:
David Rodríguez 2023-05-25 13:39:33 +02:00 committed by Hiroshi SHIBATA
parent ebe1077330
commit 1f9e66836b
2 changed files with 26 additions and 0 deletions

View File

@ -217,6 +217,7 @@ module Bundler
rescue BundlerError => e rescue BundlerError => e
@resolve = nil @resolve = nil
@resolver = nil @resolver = nil
@resolution_packages = nil
@specs = nil @specs = nil
@gem_version_promoter = nil @gem_version_promoter = nil

View File

@ -191,6 +191,31 @@ RSpec.describe "bundler/inline#gemfile" do
expect(err).to be_empty expect(err).to be_empty
end end
it "installs subdependencies quietly if necessary when the install option is not set, and multiple sources used" do
build_repo4 do
build_gem "rack" do |s|
s.add_dependency "rackdep"
end
build_gem "rackdep", "1.0.0"
end
script <<-RUBY
gemfile do
source "#{file_uri_for(gem_repo1)}"
source "#{file_uri_for(gem_repo4)}" do
gem "rack"
end
end
require "rackdep"
puts RACKDEP
RUBY
expect(out).to eq("1.0.0")
expect(err).to be_empty
end
it "installs quietly from git if necessary when the install option is not set" do it "installs quietly from git if necessary when the install option is not set" do
build_git "foo", "1.0.0" build_git "foo", "1.0.0"
baz_ref = build_git("baz", "2.0.0").ref_for("HEAD") baz_ref = build_git("baz", "2.0.0").ref_for("HEAD")