diff options
author | The Bundler Bot <bot@bundler.io> | 2018-02-01 16:52:55 +0000 |
---|---|---|
committer | The Bundler Bot <bot@bundler.io> | 2018-02-01 16:52:55 +0000 |
commit | 8a32d643d0daef1776c075404820cc86ee699ce4 (patch) | |
tree | 37fd30cf6ea8a95f517827ca3173008ee30632bf /lib | |
parent | db3e04cd00179fc6f52f76673dea48fab9ee4b0b (diff) | |
parent | 99d7fd1333ee9fcb4fbdb04a6c5ae51412c79d08 (diff) | |
download | bundler-8a32d643d0daef1776c075404820cc86ee699ce4.tar.gz |
Auto merge of #6211 - papanikge:add-source-when-failing, r=segiddins
Add explicit source when available in the error msg upon failure
### What was the end-user problem that led to this PR?
My bundling failed and the command that `bundler` output was wrong-ish, in the sense that my gem was suppose to come from a different source.
### What was your diagnosis of the problem?
The error message was not explicit.
### What is your fix for the problem, implemented in this PR?
Bundler now explicitly print the source when there's just one. I think it's a good case just to print it when there's one. If there are more it's ambiguous, so we fallback to the old way. Maybe we could have a warning there that the command might not be exactly what the user wants.
### Why did you choose this fix out of the possible options?
See previous answer. I didn't find any easier ways of getting the source url.
Let me know if there are better implementations :)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bundler/installer/gem_installer.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/bundler/installer/gem_installer.rb b/lib/bundler/installer/gem_installer.rb index 086b763d20..a38f8d95be 100644 --- a/lib/bundler/installer/gem_installer.rb +++ b/lib/bundler/installer/gem_installer.rb @@ -44,7 +44,12 @@ module Bundler end def gem_install_message - "Make sure that `gem install #{spec.name} -v '#{spec.version}'` succeeds before bundling." + remotes = spec.source.remotes + if remotes.size == 1 + "Make sure that `gem install #{spec.name} -v '#{spec.version}' --source '#{remotes.first}'` succeeds before bundling." + else + "Make sure that `gem install #{spec.name} -v '#{spec.version}'` succeeds before bundling." + end end def spec_settings |