diff options
author | André Arko <mail@arko.net> | 2015-03-26 10:50:47 -0700 |
---|---|---|
committer | André Arko <mail@arko.net> | 2015-03-26 10:50:47 -0700 |
commit | 376515122b75ca50b04ddcb1488d28067f2c3684 (patch) | |
tree | 28eb193447b078fb9d00b2daf85b0fbcf7a3f0e5 | |
parent | 71b34bb7af47e895d5d519852faa9fdf0345162c (diff) | |
parent | 79d46462961a47010142aa2606734996f4acc397 (diff) | |
download | bundler-376515122b75ca50b04ddcb1488d28067f2c3684.tar.gz |
Merge pull request #3510 from pducks32/master
Setting to ignore post_install messages per-gem
-rw-r--r-- | lib/bundler/cli/install.rb | 8 | ||||
-rw-r--r-- | spec/install/gems/post_install_spec.rb | 195 |
2 files changed, 111 insertions, 92 deletions
diff --git a/lib/bundler/cli/install.rb b/lib/bundler/cli/install.rb index 4d6715120b..24445542c2 100644 --- a/lib/bundler/cli/install.rb +++ b/lib/bundler/cli/install.rb @@ -92,8 +92,7 @@ module Bundler end Installer.post_install_messages.to_a.each do |name, msg| - Bundler.ui.confirm "Post-install message from #{name}:" - Bundler.ui.info msg + print_post_install_message(name, msg) unless Bundler.settings["ignore_messages.#{name}"] end Installer.ambiguous_gems.to_a.each do |name, installed_from_uri, *also_found_in_uris| @@ -152,5 +151,10 @@ 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 + end end diff --git a/spec/install/gems/post_install_spec.rb b/spec/install/gems/post_install_spec.rb index 69841fea44..e12c3e3827 100644 --- a/spec/install/gems/post_install_spec.rb +++ b/spec/install/gems/post_install_spec.rb @@ -1,121 +1,136 @@ require 'spec_helper' -describe "bundle install with gem sources" do - describe "when gems include post install messages" do - it "should display the post-install messages after installing" do - gemfile <<-G - source "file://#{gem_repo1}" - gem 'rack' - gem 'thin' - gem 'rack-obama' - G - - bundle :install - expect(out).to include("Post-install message from rack:") - expect(out).to include("Rack's post install message") - expect(out).to include("Post-install message from thin:") - expect(out).to include("Thin's post install message") - expect(out).to include("Post-install message from rack-obama:") - expect(out).to include("Rack-obama's post install message") +describe "bundle install" do + context "with gem sources" do + context "when gems include post install messages" do + it "should display the post-install messages after installing" do + gemfile <<-G + source "file://#{gem_repo1}" + gem 'rack' + gem 'thin' + gem 'rack-obama' + G + + bundle :install + expect(out).to include("Post-install message from rack:") + expect(out).to include("Rack's post install message") + expect(out).to include("Post-install message from thin:") + expect(out).to include("Thin's post install message") + expect(out).to include("Post-install message from rack-obama:") + expect(out).to include("Rack-obama's post install message") + end end - end - describe "when gems do not include post install messages" do - it "should not display any post-install messages" do - gemfile <<-G - source "file://#{gem_repo1}" - gem "activesupport" - G + context "when gems do not include post install messages" do + it "should not display any post-install messages" do + gemfile <<-G + source "file://#{gem_repo1}" + gem "activesupport" + G - bundle :install - expect(out).not_to include("Post-install message") + bundle :install + expect(out).not_to include("Post-install message") + end end - end - describe "when a dependecy includes a post install message" do - it "should display the post install message" do - gemfile <<-G - source "file://#{gem_repo1}" - gem 'rack_middleware' - G + context "when a dependecy includes a post install message" do + it "should display the post install message" do + gemfile <<-G + source "file://#{gem_repo1}" + gem 'rack_middleware' + G - bundle :install - expect(out).to include("Post-install message from rack:") - expect(out).to include("Rack's post install message") + bundle :install + expect(out).to include("Post-install message from rack:") + expect(out).to include("Rack's post install message") + end end end -end -describe "bundle install with git sources" do - describe "when gems include post install messages" do - it "should display the post-install messages after installing" do - build_git "foo" do |s| - s.post_install_message = "Foo's post install message" + context "with git sources" do + context "when gems include post install messages" do + it "should display the post-install messages after installing" do + build_git "foo" do |s| + s.post_install_message = "Foo's post install message" + end + gemfile <<-G + source "file://#{gem_repo1}" + gem 'foo', :git => '#{lib_path("foo-1.0")}' + G + + bundle :install + expect(out).to include("Post-install message from foo:") + expect(out).to include("Foo's post install message") end - gemfile <<-G - source "file://#{gem_repo1}" - gem 'foo', :git => '#{lib_path("foo-1.0")}' - G - bundle :install - expect(out).to include("Post-install message from foo:") - expect(out).to include("Foo's post install message") - end - - it "should display the post-install messages if repo is updated" do - build_git "foo" do |s| - s.post_install_message = "Foo's post install message" + it "should display the post-install messages if repo is updated" do + build_git "foo" do |s| + s.post_install_message = "Foo's post install message" + end + gemfile <<-G + source "file://#{gem_repo1}" + gem 'foo', :git => '#{lib_path("foo-1.0")}' + G + bundle :install + + build_git "foo", "1.1" do |s| + s.post_install_message = "Foo's 1.1 post install message" + end + gemfile <<-G + source "file://#{gem_repo1}" + gem 'foo', :git => '#{lib_path("foo-1.1")}' + G + bundle :install + + expect(out).to include("Post-install message from foo:") + expect(out).to include("Foo's 1.1 post install message") end - gemfile <<-G - source "file://#{gem_repo1}" - gem 'foo', :git => '#{lib_path("foo-1.0")}' - G - bundle :install - build_git "foo", "1.1" do |s| - s.post_install_message = "Foo's 1.1 post install message" + it "should not display the post-install messages if repo is not updated" do + build_git "foo" do |s| + s.post_install_message = "Foo's post install message" + end + gemfile <<-G + source "file://#{gem_repo1}" + gem 'foo', :git => '#{lib_path("foo-1.0")}' + G + + bundle :install + expect(out).to include("Post-install message from foo:") + expect(out).to include("Foo's post install message") + + bundle :install + expect(out).not_to include("Post-install message") end - gemfile <<-G - source "file://#{gem_repo1}" - gem 'foo', :git => '#{lib_path("foo-1.1")}' - G - bundle :install - - expect(out).to include("Post-install message from foo:") - expect(out).to include("Foo's 1.1 post install message") end - it "should not display the post-install messages if repo is not updated" do - build_git "foo" do |s| - s.post_install_message = "Foo's post install message" + context "when gems do not include post install messages" do + it "should not display any post-install messages" do + build_git "foo" do |s| + s.post_install_message = nil + end + gemfile <<-G + source "file://#{gem_repo1}" + gem 'foo', :git => '#{lib_path("foo-1.0")}' + G + + bundle :install + expect(out).not_to include("Post-install message") end - gemfile <<-G - source "file://#{gem_repo1}" - gem 'foo', :git => '#{lib_path("foo-1.0")}' - G - - bundle :install - expect(out).to include("Post-install message from foo:") - expect(out).to include("Foo's post install message") - - bundle :install - expect(out).not_to include("Post-install message") end end - describe "when gems do not include post install messages" do - it "should not display any post-install messages" do - build_git "foo" do |s| - s.post_install_message = nil - end + context "when ignore post-install messages for gem is set" do + it "doesn't display any post-install messages" do gemfile <<-G source "file://#{gem_repo1}" - gem 'foo', :git => '#{lib_path("foo-1.0")}' + gem "rack" G + bundle "config ignore_messages.rack true" + bundle :install expect(out).not_to include("Post-install message") end end - end |