diff options
author | The Bundler Bot <bot@bundler.io> | 2016-12-17 18:49:27 +0000 |
---|---|---|
committer | The Bundler Bot <bot@bundler.io> | 2016-12-17 18:49:27 +0000 |
commit | 4f3e0ec66d6f72d00b552959db1dae89b83b4a4e (patch) | |
tree | ea267558b81534633ef563f392cfd9832d4cf86e /lib/bundler/cli | |
parent | 380a91cf7d43033acea9c9a9369211cba68b8fe6 (diff) | |
parent | ecd54cc1e433c65b4ceb3847331fd225cc28633c (diff) | |
download | bundler-4f3e0ec66d6f72d00b552959db1dae89b83b4a4e.tar.gz |
Auto merge of #5240 - smathy:update_post_install_messages, r=segiddins
`bundle update` post install messages
Currently post install messages are only displayed for `bundle install` not for `bundle update`. This PR fixes that so they're displayed for both, and includes a small refactor of some duplicated functionality between `install` and `update`
Diffstat (limited to 'lib/bundler/cli')
-rw-r--r-- | lib/bundler/cli/common.rb | 17 | ||||
-rw-r--r-- | lib/bundler/cli/install.rb | 21 | ||||
-rw-r--r-- | lib/bundler/cli/update.rb | 13 |
3 files changed, 24 insertions, 27 deletions
diff --git a/lib/bundler/cli/common.rb b/lib/bundler/cli/common.rb index 40a429ba..c1e108d7 100644 --- a/lib/bundler/cli/common.rb +++ b/lib/bundler/cli/common.rb @@ -1,6 +1,23 @@ # frozen_string_literal: true module Bundler module CLI::Common + def self.output_post_install_messages(messages) + return if Bundler.settings["ignore_messages"] + messages.to_a.each do |name, msg| + print_post_install_message(name, msg) unless Bundler.settings["ignore_messages.#{name}"] + end + end + + def self.print_post_install_message(name, msg) + Bundler.ui.confirm "Post-install message from #{name}:" + Bundler.ui.info msg + end + + def self.output_without_groups_message + return unless Bundler.settings.without.any? + Bundler.ui.confirm without_groups_message + end + def self.without_groups_message groups = Bundler.settings.without group_list = [groups[0...-1].join(", "), groups[-1..-1]]. diff --git a/lib/bundler/cli/install.rb b/lib/bundler/cli/install.rb index b5a54ae8..b21693a3 100644 --- a/lib/bundler/cli/install.rb +++ b/lib/bundler/cli/install.rb @@ -1,4 +1,6 @@ # frozen_string_literal: true +require "bundler/cli/common" + module Bundler class CLI::Install attr_reader :options @@ -69,7 +71,7 @@ module Bundler Bundler.load.cache if Bundler.app_cache.exist? && !options["no-cache"] && !Bundler.settings[:frozen] Bundler.ui.confirm "Bundle complete! #{dependencies_count_for(definition)}, #{gems_installed_for(definition)}." - confirm_without_groups + Bundler::CLI::Common.output_without_groups_message if Bundler.settings[:path] absolute_path = File.expand_path(Bundler.settings[:path]) @@ -79,11 +81,7 @@ module Bundler Bundler.ui.confirm "Use `bundle show [gemname]` to see where a bundled gem is installed." end - unless Bundler.settings["ignore_messages"] - installer.post_install_messages.to_a.each do |name, msg| - print_post_install_message(name, msg) unless Bundler.settings["ignore_messages.#{name}"] - end - end + Bundler::CLI::Common.output_post_install_messages installer.post_install_messages warn_ambiguous_gems @@ -132,12 +130,6 @@ module Bundler end end - def confirm_without_groups - return unless Bundler.settings.without.any? - require "bundler/cli/common" - Bundler.ui.confirm Bundler::CLI::Common.without_groups_message - end - def dependencies_count_for(definition) count = definition.dependencies.count "#{count} Gemfile #{count == 1 ? "dependency" : "dependencies"}" @@ -148,11 +140,6 @@ module Bundler "#{count} #{count == 1 ? "gem" : "gems"} now installed" end - def print_post_install_message(name, msg) - Bundler.ui.confirm "Post-install message from #{name}:" - Bundler.ui.info msg - end - def check_for_group_conflicts if options[:without] && options[:with] conflicting_groups = options[:without] & options[:with] diff --git a/lib/bundler/cli/update.rb b/lib/bundler/cli/update.rb index bc8231d3..8a7541c2 100644 --- a/lib/bundler/cli/update.rb +++ b/lib/bundler/cli/update.rb @@ -52,7 +52,7 @@ module Bundler Bundler.settings[:jobs] = opts["jobs"] if opts["jobs"] Bundler.definition.validate_runtime! - Installer.install Bundler.root, Bundler.definition, opts + installer = Installer.install Bundler.root, Bundler.definition, opts Bundler.load.cache if Bundler.app_cache.exist? if Bundler.settings[:clean] && Bundler.settings[:path] @@ -61,15 +61,8 @@ module Bundler end Bundler.ui.confirm "Bundle updated!" - without_groups_messages - end - - private - - def without_groups_messages - return unless Bundler.settings.without.any? - require "bundler/cli/common" - Bundler.ui.confirm Bundler::CLI::Common.without_groups_message + Bundler::CLI::Common.output_without_groups_message + Bundler::CLI::Common.output_post_install_messages installer.post_install_messages end end end |