diff options
-rw-r--r-- | lib/bundler/definition.rb | 10 | ||||
-rw-r--r-- | spec/bundler/install/deploy_spec.rb | 34 |
2 files changed, 41 insertions, 3 deletions
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb index 5db59efe03..268f424928 100644 --- a/lib/bundler/definition.rb +++ b/lib/bundler/definition.rb @@ -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 diff --git a/spec/bundler/install/deploy_spec.rb b/spec/bundler/install/deploy_spec.rb index 5dcbf91e33..2a88ed5b06 100644 --- a/spec/bundler/install/deploy_spec.rb +++ b/spec/bundler/install/deploy_spec.rb @@ -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 |