[rubygems/rubygems] Regenerate lockfile if spec list is invalid/empty.

https://github.com/rubygems/rubygems/commit/d2c56315e2
This commit is contained in:
Ellen Marie Dash 2023-02-28 19:29:58 -05:00 committed by git
parent 35457ebb8f
commit d2d521b274
2 changed files with 54 additions and 1 deletions

View File

@ -44,7 +44,9 @@ module Bundler
incomplete = true incomplete = true
end end
@incomplete_specs += lookup[name] if incomplete && check if incomplete && check
@incomplete_specs += lookup[name].any? ? lookup[name] : [LazySpecification.new(name, nil, nil)]
end
end end
specs specs

View File

@ -1221,6 +1221,57 @@ RSpec.describe "the lockfile format" do
and include("Either installing with `--full-index` or running `bundle update rack_middleware` should fix the problem.") and include("Either installing with `--full-index` or running `bundle update rack_middleware` should fix the problem.")
end end
it "regenerates a lockfile with no specs" do
build_repo4 do
build_gem "indirect_dependency", "1.2.3" do |s|
s.metadata["funding_uri"] = "https://example.com/donate"
end
build_gem "direct_dependency", "4.5.6" do |s|
s.add_dependency "indirect_dependency", ">= 0"
end
end
lockfile <<-G
GEM
remote: #{file_uri_for(gem_repo4)}/
specs:
PLATFORMS
ruby
DEPENDENCIES
direct_dependency
BUNDLED WITH
#{Bundler::VERSION}
G
install_gemfile <<-G
source "#{file_uri_for(gem_repo4)}"
gem "direct_dependency"
G
expect(lockfile).to eq <<~G
GEM
remote: #{file_uri_for(gem_repo4)}/
specs:
direct_dependency (4.5.6)
indirect_dependency
indirect_dependency (1.2.3)
PLATFORMS
#{lockfile_platforms}
DEPENDENCIES
direct_dependency
BUNDLED WITH
#{Bundler::VERSION}
G
end
it "auto-heals when the lockfile is missing dependent specs" do it "auto-heals when the lockfile is missing dependent specs" do
build_repo4 do build_repo4 do
build_gem "minitest-bisect", "1.6.0" do |s| build_gem "minitest-bisect", "1.6.0" do |s|