Skip to content

Commit

Permalink
Merge pull request #7197 from rubygems/segiddins/allow-auto-install-t…
Browse files Browse the repository at this point in the history
…o-install-missing-git-gems

Allow auto-install to install missing git gems
  • Loading branch information
hsbt committed Nov 30, 2023
2 parents 87fb044 + e25a339 commit 94c1b5e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion bundler/lib/bundler/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@ def auto_install

begin
Bundler.definition.specs
rescue GemNotFound
rescue GemNotFound, GitError
Bundler.ui.info "Automatically installing missing gems."
Bundler.reset!
invoke :install, []
Expand Down
17 changes: 17 additions & 0 deletions bundler/spec/commands/exec_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,23 @@
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"
Expand Down

0 comments on commit 94c1b5e

Please sign in to comment.