[rubygems/rubygems] Improve error message in frozen mode edge case

When a top level dependency is missing from the lockfile, and we're in
frozen mode, we should also print a "frozen error".

https://github.com/rubygems/rubygems/commit/3e82b835e3
This commit is contained in:
David Rodríguez 2023-06-10 00:24:54 +02:00 коммит произвёл Hiroshi SHIBATA
Родитель e86f4c581b
Коммит 3e7f5b02ae
2 изменённых файлов: 41 добавлений и 3 удалений

Просмотреть файл

@ -677,10 +677,14 @@ module Bundler
if missing.any?
@locked_specs.delete(missing)
missing.first.name
else
false
return missing.first.name
end
return if @dependency_changes
current_dependencies.find do |d|
@locked_specs[d.name].empty?
end&.name
end
def converge_paths

Просмотреть файл

@ -312,6 +312,40 @@ RSpec.describe "install in deployment or frozen mode" do
expect(last_command).to be_success
end
it "shows a good error if a gem is missing from the lockfile" do
build_repo4 do
build_gem "foo"
build_gem "bar"
end
gemfile <<-G
source "https://gem.repo4"
gem "foo"
gem "bar"
G
lockfile <<~L
GEM
remote: https://gem.repo4/
specs:
foo (1.0)
PLATFORMS
#{lockfile_platforms}
DEPENDENCIES
foo
bar
BUNDLED WITH
#{Bundler::VERSION}
L
bundle :install, :env => { "BUNDLE_FROZEN" => "true" }, :raise_on_error => false, :artifice => "compact_index"
expect(err).to include("Your lock file is missing \"bar\", but the lockfile can't be updated because frozen mode is set")
end
it "explodes if a path gem is missing" do
build_lib "path_gem"
install_gemfile <<-G