[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:
parent
e86f4c581b
commit
3e7f5b02ae
@ -677,10 +677,14 @@ module Bundler
|
|||||||
if missing.any?
|
if missing.any?
|
||||||
@locked_specs.delete(missing)
|
@locked_specs.delete(missing)
|
||||||
|
|
||||||
missing.first.name
|
return missing.first.name
|
||||||
else
|
|
||||||
false
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
return if @dependency_changes
|
||||||
|
|
||||||
|
current_dependencies.find do |d|
|
||||||
|
@locked_specs[d.name].empty?
|
||||||
|
end&.name
|
||||||
end
|
end
|
||||||
|
|
||||||
def converge_paths
|
def converge_paths
|
||||||
|
@ -312,6 +312,40 @@ RSpec.describe "install in deployment or frozen mode" do
|
|||||||
expect(last_command).to be_success
|
expect(last_command).to be_success
|
||||||
end
|
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
|
it "explodes if a path gem is missing" do
|
||||||
build_lib "path_gem"
|
build_lib "path_gem"
|
||||||
install_gemfile <<-G
|
install_gemfile <<-G
|
||||||
|
Loading…
x
Reference in New Issue
Block a user