Skip to content

Loading…

Write skipped groups to output for bundle install and update actions. #2360

Closed
wants to merge 1 commit into from

4 participants

@simi

Better output for bundle install update

I'll try to make better test suite to catch all cases.
Idea by @plentz and @indirect in #2347.

Output for fresh bundle install:

Use `bundle show [gemname]` to see where a bundled gem is installed.
Your bundle is complete!

Output for bundle update without skipped groups:

Use `bundle show [gemname]` to see where a bundled gem is installed.
Your bundle is updated!

Output for bundle install --without development test:

Use `bundle show [gemname]` to see where a bundled gem is installed.
Skipped groups for this bundle are: development test.
Your bundle is complete!

Output for bundle install --deployment --without development test:

Skipped groups for this bundle are: development test.
Your bundle is complete!
It was installed into ./vendor/bundle

Output for bundle update with skipped groups in memory:

Use `bundle show [gemname]` to see where a bundled gem is installed.
Skipped groups for this bundle are: development test.
Your bundle is updated!
@plentz

@simi great!

@indirect
Bundler member

Thanks for doing this! Tests would be great. :)

@simi

I added some dumb silly tests for output changes made by me. I'm not best rspec master :/ Feel free to point me to better test style.

@simi

@indirect please can you restart https://travis-ci.org/carlhuda/bundler/builds/5265295 build please? One of realworld tests failed in one case unrelated to my changes.

@indirect
Bundler member
@simi

@indirect If you are ok with this change I can add changelog note (according to documentation) and squash it all into one commit. And as a benefit, that will trigger new build also.

@indirect
Bundler member

@simi sounds good to me, thanks! :)

@simi

All green now @indirect.

@indirect
Bundler member

merged in f874dccfc0842ee5d2f70f6881a437d267b6c841. Thanks again!

@indirect indirect closed this
@equivalent

nice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Showing with 158 additions and 5 deletions.
  1. +6 −0 CHANGELOG.md
  2. +18 −5 lib/bundler/cli.rb
  3. +16 −0 spec/install/gems/groups_spec.rb
  4. +118 −0 spec/install/post_bundle_message_spec.rb
View
6 CHANGELOG.md
@@ -1,3 +1,9 @@
+## 1.3.2 (tbd)
+
+Features:
+
+ - mention skipped groups in bundle install and bundle update output (@simi)
+
## 1.3.1 (3 March 2013)
Bugfixes:
View
23 lib/bundler/cli.rb
@@ -251,11 +251,13 @@ def install
if Bundler.settings[:path]
absolute_path = File.expand_path(Bundler.settings[:path])
relative_path = absolute_path.sub(File.expand_path('.'), '.')
- Bundler.ui.confirm "Your bundle is complete! " +
+ Bundler.ui.confirm without_groups_message.to_s +
+ "Your bundle is complete!\n" +
"It was installed into #{relative_path}"
else
- Bundler.ui.confirm "Your bundle is complete! " +
- "Use `bundle show [gemname]` to see where a bundled gem is installed."
+ Bundler.ui.confirm use_budle_show_message +
+ without_groups_message.to_s +
+ "Your bundle is complete!"
end
Installer.post_install_messages.to_a.each do |name, msg|
Bundler.ui.confirm "Post-install message from #{name}:\n#{msg}"
@@ -316,8 +318,9 @@ def update(*gems)
Installer.install Bundler.root, Bundler.definition, opts
Bundler.load.cache if Bundler.root.join("vendor/cache").exist?
clean if Bundler.settings[:clean] && Bundler.settings[:path]
- Bundler.ui.confirm "Your bundle is updated! " +
- "Use `bundle show [gemname]` to see where a bundled gem is installed."
+ Bundler.ui.confirm use_budle_show_message +
+ without_groups_message.to_s +
+ "Your bundle is updated!"
end
desc "show [GEM]", "Shows all gems that are part of the bundle, or the path to a given gem"
@@ -858,5 +861,15 @@ def pager_system
pager ||= 'cat'
end
+ def without_groups_message
+ if Bundler.settings.without.any?
+ "Skipped groups for this bundle are: #{Bundler.settings.without.join(' ')}.\n"
+ end
+ end
+
+ def use_budle_show_message
+ "Use `bundle show [gemname]` to see where a bundled gem is installed.\n"
+ end
+
end
end
View
16 spec/install/gems/groups_spec.rb
@@ -105,6 +105,17 @@
expect(out).not_to include("activesupport")
end
+ it "does say the groups are skipped from the previously excluded groups" do
+ bundle :install, :without => "emo"
+ bundle :install
+ expect(out).to include("Skipped groups for this bundle are: emo.")
+ end
+
+ it "does say the group is skipped" do
+ bundle :install, :without => "emo"
+ expect(out).to include("Skipped groups for this bundle are: emo.")
+ end
+
it "allows Bundler.setup for specific groups" do
bundle :install, :without => "emo"
run("require 'rack'; puts RACK", :default)
@@ -217,6 +228,11 @@
bundle "install --without 'emo lolercoaster'"
should_not_be_installed "activesupport 2.3.5"
end
+
+ it "does say the groups are skipped" do
+ bundle "install --without 'emo lolercoaster'"
+ expect(out).to include("Skipped groups for this bundle are: emo lolercoaster.")
+ end
end
end
View
118 spec/install/post_bundle_message_spec.rb
@@ -0,0 +1,118 @@
+require 'spec_helper'
+
+describe "post bundle message" do
+ before :each do
+ gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "rack"
+ gem "activesupport", "2.3.5", :group => [:emo, :test]
+ group :test do
+ gem "rspec"
+ end
+ G
+ end
+
+ let(:bundle_show_message) {"Use `bundle show [gemname]` to see where a bundled gem is installed.\n"}
+ let(:bundle_deployment_message) {"It was installed into ./vendor/bundle"}
+ let(:bundle_complete_message) {"Your bundle is complete!"}
+ let(:bundle_updated_message) {"Your bundle is updated!"}
+
+ describe "for fresh bundle install" do
+ it "without any options" do
+ bundle :install
+ expect(out).to include(bundle_show_message)
+ expect(out).not_to include("Skipped groups")
+ expect(out).to include(bundle_complete_message)
+ end
+
+ it "with --without one group" do
+ bundle :install, :without => :emo
+ expect(out).to include(bundle_show_message)
+ expect(out).to include("Skipped groups for this bundle are: emo.\n")
+ expect(out).to include(bundle_complete_message)
+ end
+
+ it "with --without more group" do
+ bundle "install --without emo test"
+ expect(out).to include(bundle_show_message)
+ expect(out).to include("Skipped groups for this bundle are: emo test.\n")
+ expect(out).to include(bundle_complete_message)
+ end
+
+ describe "with --deployment and" do
+ it "without any options" do
+ bundle :install
+ bundle "install --deployment", :exitstatus => true
+ expect(out).to include(bundle_deployment_message)
+ expect(out).not_to include("Skipped groups")
+ expect(out).to include(bundle_complete_message)
+ end
+
+ it "with --without one group" do
+ bundle :install
+ bundle "install --without emo --deployment"
+ expect(out).to include(bundle_deployment_message)
+ expect(out).to include("Skipped groups for this bundle are: emo.\n")
+ expect(out).to include(bundle_complete_message)
+ end
+
+ it "with --without more group" do
+ bundle :install
+ bundle "install --without emo test --deployment"
+ expect(out).to include(bundle_deployment_message)
+ expect(out).to include("Skipped groups for this bundle are: emo test.\n")
+ expect(out).to include(bundle_complete_message)
+ end
+ end
+ end
+
+ describe "for second bundle install run" do
+ it "without any options" do
+ 2.times { bundle :install }
+ bundle :install
+ expect(out).to include(bundle_show_message)
+ expect(out).not_to include("Skipped groups")
+ expect(out).to include(bundle_complete_message)
+ end
+
+ it "with --without one group" do
+ 2.times { bundle :install, :without => :emo }
+ expect(out).to include(bundle_show_message)
+ expect(out).to include("Skipped groups for this bundle are: emo.\n")
+ expect(out).to include(bundle_complete_message)
+ end
+
+ it "with --without more group" do
+ 2.times { bundle "install --without emo test" }
+ expect(out).to include(bundle_show_message)
+ expect(out).to include("Skipped groups for this bundle are: emo test.\n")
+ expect(out).to include(bundle_complete_message)
+ end
+ end
+
+ describe "for bundle update" do
+ it "without any options" do
+ bundle :install
+ bundle :update
+ expect(out).to include(bundle_show_message)
+ expect(out).not_to include("Skipped groups")
+ expect(out).to include(bundle_updated_message)
+ end
+
+ it "with --without one group" do
+ bundle :install, :without => :emo
+ bundle :update
+ expect(out).to include(bundle_show_message)
+ expect(out).to include("Skipped groups for this bundle are: emo.\n")
+ expect(out).to include(bundle_updated_message)
+ end
+
+ it "with --without more group" do
+ bundle "install --without emo test"
+ bundle :update
+ expect(out).to include(bundle_show_message)
+ expect(out).to include("Skipped groups for this bundle are: emo test.\n")
+ expect(out).to include(bundle_updated_message)
+ end
+ end
+end
Something went wrong with that request. Please try again.