summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHomu <homu@barosl.com>2016-07-30 07:30:14 +0900
committerHomu <homu@barosl.com>2016-07-30 07:30:14 +0900
commit9dd84228ddf50af118efbc68bf341c0b1eb00e1a (patch)
treeb40fe73e82b5d3dc5fb23c9938faac45074bada4
parent11e2feaca8c62aea28a749cb506e69b2f943132e (diff)
parentaafc067f7f54b2bfaab0267d445eec6753d1f1da (diff)
downloadbundler-9dd84228ddf50af118efbc68bf341c0b1eb00e1a.tar.gz
Auto merge of #4820 - b-ggs:4752-not-print-version-match, r=RochesterinNYC
Bundler version warning should not print when versions match Closes #4752 @RochesterinNYC @indirect
-rw-r--r--lib/bundler/cli/install.rb1
-rw-r--r--spec/commands/install_spec.rb7
2 files changed, 8 insertions, 0 deletions
diff --git a/lib/bundler/cli/install.rb b/lib/bundler/cli/install.rb
index 2dee4a5a77..e8a3aba2f3 100644
--- a/lib/bundler/cli/install.rb
+++ b/lib/bundler/cli/install.rb
@@ -125,6 +125,7 @@ module Bundler
return if ENV["BUNDLE_POSTIT_TRAMPOLINING_VERSION"].nil?
installed_version = Gem::Version.new(ENV["BUNDLE_POSTIT_TRAMPOLINING_VERSION"].dup)
running_version = Gem::Version.new(Bundler::VERSION)
+ return if Gem::Requirement.new(installed_version).satisfied_by?(running_version)
if Bundler.settings[:warned_version].nil? || running_version > Gem::Version.new(Bundler.settings[:warned_version])
Bundler.settings[:warned_version] = running_version
Bundler.ui.warn "You're running Bundler #{installed_version} but this " \
diff --git a/spec/commands/install_spec.rb b/spec/commands/install_spec.rb
index ea2c3c0078..89a9138dab 100644
--- a/spec/commands/install_spec.rb
+++ b/spec/commands/install_spec.rb
@@ -498,5 +498,12 @@ describe "bundle install with gem sources" do
bundle :install, :env => { "BUNDLE_POSTIT_TRAMPOLINING_VERSION" => "999" }
expect(out).not_to include("You're running Bundler 999 but this project uses #{Bundler::VERSION}.")
end
+
+ it "should not print warning if versions match" do
+ bundle :init
+ bundle :install, :env => { "BUNDLE_POSTIT_TRAMPOLINING_VERSION" => Bundler::VERSION }
+ expect(out).to start_with("Running `bundle install --no-color` with bundler #{Bundler::VERSION}\nThe Gemfile specifies no dependencies")
+ expect(out).not_to include("You're running Bundler #{Bundler::VERSION} but this project uses #{Bundler::VERSION}.")
+ end
end
end