summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKir Shatrov <shatrov@me.com>2013-08-17 18:30:33 +0400
committerXavier Shay <xavier@rhnh.net>2013-08-18 07:41:40 -0700
commit12eee6adc99fac9074c223e52c643ee59932dedf (patch)
tree0b873a3a0c0fe1a79003eed7977e5f3717e00464
parent80655dc10b46925b4dd5220dfdfbd1f94f90cf2d (diff)
downloadbundler-12eee6adc99fac9074c223e52c643ee59932dedf.tar.gz
When git gem install fails, don't suggest `gem install foo`
-rw-r--r--lib/bundler/installer.rb8
-rw-r--r--spec/install/git_spec.rb20
2 files changed, 26 insertions, 2 deletions
diff --git a/lib/bundler/installer.rb b/lib/bundler/installer.rb
index f6c1eaefc7..393cbe7c79 100644
--- a/lib/bundler/installer.rb
+++ b/lib/bundler/installer.rb
@@ -131,8 +131,12 @@ module Bundler
Bundler.ui.info ""
Bundler.ui.warn "#{e.class}: #{e.message}"
msg = "An error occurred while installing #{spec.name} (#{spec.version}),"
- msg << " and Bundler cannot continue.\nMake sure that `gem install"
- msg << " #{spec.name} -v '#{spec.version}'` succeeds before bundling."
+ msg << " and Bundler cannot continue."
+
+ unless spec.source.options["git"]
+ msg << "\nMake sure that `gem install"
+ msg << " #{spec.name} -v '#{spec.version}'` succeeds before bundling."
+ end
Bundler.ui.debug e.backtrace.join("\n")
raise Bundler::InstallError, msg
end
diff --git a/spec/install/git_spec.rb b/spec/install/git_spec.rb
index f970504d09..ae9e5a145b 100644
--- a/spec/install/git_spec.rb
+++ b/spec/install/git_spec.rb
@@ -853,6 +853,26 @@ describe "bundle install with git sources" do
R
expect(out).to eq("YES")
end
+
+ it "does not prompt to gem install if extension fails" do
+ build_git "foo" do |s|
+ s.add_dependency "rake"
+ s.extensions << "Rakefile"
+ s.write "Rakefile", <<-RUBY
+ task :default do
+ raise
+ end
+ RUBY
+ end
+
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "foo", :git => "#{lib_path('foo-1.0')}"
+ G
+
+ expect(out).to include("An error occurred while installing foo (1.0)")
+ expect(out).not_to include("gem install foo")
+ end
end
end