diff options
author | Andrew Bloomgarden <stalkingtiger@gmail.com> | 2014-04-06 13:47:02 -0700 |
---|---|---|
committer | Andre Arko <andre@arko.net> | 2014-04-07 09:28:49 +0700 |
commit | 65a7f6048e68317c96f626265529403aad7310ba (patch) | |
tree | 6ff4c9213da243ff4ca7fd06f029378f9c1565a7 | |
parent | 8a4e89b75b3df94d3d21184bdf5075c00c036f29 (diff) | |
download | bundler-65a7f6048e68317c96f626265529403aad7310ba.tar.gz |
Fix deploying git gems without git (#2968)
If git isn't allowed to run, we don't blow up if we don't have it.
-rw-r--r-- | lib/bundler/source/git/git_proxy.rb | 2 | ||||
-rw-r--r-- | spec/install/gemfile/git_spec.rb | 16 |
2 files changed, 17 insertions, 1 deletions
diff --git a/lib/bundler/source/git/git_proxy.rb b/lib/bundler/source/git/git_proxy.rb index e1ebbfa4ca..573aae6dec 100644 --- a/lib/bundler/source/git/git_proxy.rb +++ b/lib/bundler/source/git/git_proxy.rb @@ -40,7 +40,7 @@ module Bundler @ref = ref @revision = revision @allow = allow || Proc.new { true } - raise GitNotInstalledError.new unless Bundler.git_present? + raise GitNotInstalledError.new if allow? && !Bundler.git_present? end def revision diff --git a/spec/install/gemfile/git_spec.rb b/spec/install/gemfile/git_spec.rb index 5d83e47b49..5d954c4966 100644 --- a/spec/install/gemfile/git_spec.rb +++ b/spec/install/gemfile/git_spec.rb @@ -947,5 +947,21 @@ describe "bundle install with git sources" do bundle "update", :env => {"PATH" => ""} expect(out).to include("You need to install git to be able to use gems from git repositories. For help installing git, please refer to GitHub's tutorial at https://help.github.com/articles/set-up-git") end + + it "installs a packaged git gem successfully" do + build_git "foo" + + install_gemfile <<-G + git "#{lib_path('foo-1.0')}" do + gem 'foo' + end + G + bundle "package --all" + simulate_new_machine + + bundle "install", :env => {"PATH" => ""}, :exitstatus => true + expect(out).to_not include("You need to install git to be able to use gems from git repositories.") + expect(exitstatus).to be_zero + end end end |