diff options
author | Samuel Giddins <segiddins@segiddins.me> | 2017-01-19 13:53:38 -0600 |
---|---|---|
committer | Samuel Giddins <segiddins@segiddins.me> | 2017-03-11 17:09:11 -0500 |
commit | 8e5bfb6af4306a3394543b3ba1c96d13c2234488 (patch) | |
tree | 0562ac6b34c3c926e9356e2dd07288519aa26f6f /lib/bundler/installer | |
parent | 6f354ad6118fea59f30828a969043209ec12c008 (diff) | |
download | bundler-8e5bfb6af4306a3394543b3ba1c96d13c2234488.tar.gz |
[ParallelInstaller] Print out why a gem needed to be installed if installation fails
Diffstat (limited to 'lib/bundler/installer')
-rw-r--r-- | lib/bundler/installer/parallel_installer.rb | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/bundler/installer/parallel_installer.rb b/lib/bundler/installer/parallel_installer.rb index b1a997f3f2..97c124e015 100644 --- a/lib/bundler/installer/parallel_installer.rb +++ b/lib/bundler/installer/parallel_installer.rb @@ -90,6 +90,7 @@ module Bundler @standalone = standalone @force = force @specs = all_specs.map {|s| SpecInstallation.new(s) } + @spec_set = all_specs end def call @@ -116,7 +117,7 @@ module Bundler spec_install.post_install_message = message elsif !success spec_install.state = :failed - spec_install.error = message + spec_install.error = "#{message}\n\n#{require_tree_for_spec(spec_install.spec)}" end spec_install } @@ -166,6 +167,19 @@ module Bundler Bundler.ui.warn(warning.join("\n")) end + def require_tree_for_spec(spec) + tree = @spec_set.what_required(spec) + t = String.new("In #{File.basename(SharedHelpers.default_gemfile)}:\n") + tree.each_with_index do |s, depth| + t << " " * depth.succ << s.name + unless tree.last == s + t << %( was resolved to #{s.version}, which depends on) + end + t << %(\n) + end + t + end + # Keys in the remains hash represent uninstalled gems specs. # We enqueue all gem specs that do not have any dependencies. # Later we call this lambda again to install specs that depended on |