diff options
author | Bundlerbot <bot@bundler.io> | 2019-04-30 07:21:59 +0000 |
---|---|---|
committer | Bundlerbot <bot@bundler.io> | 2019-04-30 07:21:59 +0000 |
commit | dd8e145596da7a9c93f11f42ce9196f591a3a6c8 (patch) | |
tree | 8b2f6f0265a225dfcac0911f3975862f0ced0147 | |
parent | 68d6e628e19e1e842bb09d4eb231c3bcff541033 (diff) | |
parent | d0d3f2786149cbaca6506b95e4be91be98161c15 (diff) | |
download | bundler-dd8e145596da7a9c93f11f42ce9196f591a3a6c8.tar.gz |
Merge #7150
7150: Proper group skip message for bundle update r=deivid-rodriguez a=deivid-rodriguez
### What was the end-user problem that led to this PR?
The problem was that when `bundle update` skipped groups, it shows a message about "gems not being installed". The message could be better and say "gems not being updated" instead, since that's what the user was trying to do.
### What was your diagnosis of the problem?
My diagnosis was that helper method was reused by the update and the install commands, but its message was specific to install.
### What is your fix for the problem, implemented in this PR?
My fix is to pass a parameter to the method with the calling command, so that the message is customized properly.
### Why did you choose this fix out of the possible options?
I chose this fix because it's easy.
Co-authored-by: David RodrÃguez <deivid.rodriguez@riseup.net>
-rw-r--r-- | lib/bundler/cli/common.rb | 9 | ||||
-rw-r--r-- | lib/bundler/cli/install.rb | 2 | ||||
-rw-r--r-- | lib/bundler/cli/update.rb | 2 | ||||
-rw-r--r-- | spec/commands/post_bundle_message_spec.rb (renamed from spec/install/post_bundle_message_spec.rb) | 6 |
4 files changed, 10 insertions, 9 deletions
diff --git a/lib/bundler/cli/common.rb b/lib/bundler/cli/common.rb index 5ec541f722..cec7bcadb4 100644 --- a/lib/bundler/cli/common.rb +++ b/lib/bundler/cli/common.rb @@ -14,17 +14,18 @@ module Bundler Bundler.ui.info msg end - def self.output_without_groups_message + def self.output_without_groups_message(command) return if Bundler.settings[:without].empty? - Bundler.ui.confirm without_groups_message + Bundler.ui.confirm without_groups_message(command) end - def self.without_groups_message + def self.without_groups_message(command) + command_in_past_tense = command == :install ? "installed" : "updated" groups = Bundler.settings[:without] group_list = [groups[0...-1].join(", "), groups[-1..-1]]. reject {|s| s.to_s.empty? }.join(" and ") group_str = groups.size == 1 ? "group" : "groups" - "Gems in the #{group_str} #{group_list} were not installed." + "Gems in the #{group_str} #{group_list} were not #{command_in_past_tense}." end def self.select_spec(name, regex_match = nil) diff --git a/lib/bundler/cli/install.rb b/lib/bundler/cli/install.rb index cf0c71d766..d823fb632f 100644 --- a/lib/bundler/cli/install.rb +++ b/lib/bundler/cli/install.rb @@ -66,7 +66,7 @@ module Bundler Bundler.load.cache if Bundler.app_cache.exist? && !options["no-cache"] && !Bundler.frozen_bundle? Bundler.ui.confirm "Bundle complete! #{dependencies_count_for(definition)}, #{gems_installed_for(definition)}." - Bundler::CLI::Common.output_without_groups_message + Bundler::CLI::Common.output_without_groups_message(:install) if Bundler.use_system_gems? Bundler.ui.confirm "Use `bundle info [gemname]` to see where a bundled gem is installed." diff --git a/lib/bundler/cli/update.rb b/lib/bundler/cli/update.rb index 45d0374eef..60ea1c2a80 100644 --- a/lib/bundler/cli/update.rb +++ b/lib/bundler/cli/update.rb @@ -95,7 +95,7 @@ module Bundler end Bundler.ui.confirm "Bundle updated!" - Bundler::CLI::Common.output_without_groups_message + Bundler::CLI::Common.output_without_groups_message(:update) Bundler::CLI::Common.output_post_install_messages installer.post_install_messages end end diff --git a/spec/install/post_bundle_message_spec.rb b/spec/commands/post_bundle_message_spec.rb index 1efd0b8146..4d3aa7b450 100644 --- a/spec/install/post_bundle_message_spec.rb +++ b/spec/commands/post_bundle_message_spec.rb @@ -185,21 +185,21 @@ The source does not contain any versions of 'not-a-gem' it "with --without one group" do bundle! :install, forgotten_command_line_options(:without => "emo") bundle! :update, :all => true - expect(out).to include("Gems in the group emo were not installed") + expect(out).to include("Gems in the group emo were not updated") expect(out).to include(bundle_updated_message) end it "with --without two groups" do bundle! :install, forgotten_command_line_options(:without => "emo test") bundle! :update, :all => true - expect(out).to include("Gems in the groups emo and test were not installed") + expect(out).to include("Gems in the groups emo and test were not updated") expect(out).to include(bundle_updated_message) end it "with --without more groups" do bundle! :install, forgotten_command_line_options(:without => "emo obama test") bundle! :update, :all => true - expect(out).to include("Gems in the groups emo, obama and test were not installed") + expect(out).to include("Gems in the groups emo, obama and test were not updated") expect(out).to include(bundle_updated_message) end end |