diff options
-rw-r--r-- | lib/bundler/cli.rb | 2 | ||||
-rw-r--r-- | spec/bundler/commands/exec_spec.rb | 17 |
2 files changed, 18 insertions, 1 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index 1f7afe72d8..c2fa92d875 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -805,7 +805,7 @@ module Bundler begin Bundler.definition.specs - rescue GemNotFound + rescue GemNotFound, GitError Bundler.ui.info "Automatically installing missing gems." Bundler.reset! invoke :install, [] diff --git a/spec/bundler/commands/exec_spec.rb b/spec/bundler/commands/exec_spec.rb index 14255dff60..760ab8dc86 100644 --- a/spec/bundler/commands/exec_spec.rb +++ b/spec/bundler/commands/exec_spec.rb @@ -615,6 +615,23 @@ RSpec.describe "bundle exec" do expect(out).to include("Installing foo 1.0") end + it "performs an automatic bundle install with git gems" do + build_git "foo" do |s| + s.executables = "foo" + end + gemfile <<-G + source "#{file_uri_for(gem_repo1)}" + gem "rack", "0.9.1" + gem "foo", :git => "#{lib_path("foo-1.0")}" + G + + bundle "config set auto_install 1" + bundle "exec foo" + expect(out).to include("Fetching rack 0.9.1") + expect(out).to include("Fetching #{lib_path("foo-1.0")}") + expect(out.lines).to end_with("1.0") + end + it "loads the correct optparse when `auto_install` is set, and optparse is a dependency" do if Gem.rubygems_version < Gem::Version.new("3.3.0.a") skip "optparse is a default gem, and rubygems loads it during install" |