diff options
author | Boggs <hello.boggs@gmail.com> | 2016-06-26 15:53:46 +0800 |
---|---|---|
committer | Boggs <hello@boggs.xyz> | 2016-06-28 09:20:35 +0800 |
commit | 961f0414fd4b955c151d8334f41ce9a2239176d8 (patch) | |
tree | 5722a8b515feb32f66b0091914089ae7d3af7333 /lib | |
parent | 4d62fefa4de732b635785f66f096d5a5b7a9fffe (diff) | |
download | bundler-961f0414fd4b955c151d8334f41ce9a2239176d8.tar.gz |
Add warnings for different versions of bundler; add specs
Remove space
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bundler/cli/install.rb | 15 | ||||
-rw-r--r-- | lib/bundler/postit_trampoline.rb | 8 |
2 files changed, 20 insertions, 3 deletions
diff --git a/lib/bundler/cli/install.rb b/lib/bundler/cli/install.rb index a087ab42..6e5d03ad 100644 --- a/lib/bundler/cli/install.rb +++ b/lib/bundler/cli/install.rb @@ -11,6 +11,8 @@ module Bundler warn_if_root + warn_if_outdated + [:with, :without].each do |option| if options[option] options[option] = options[option].join(":").tr(" ", ":").split(":") @@ -114,6 +116,19 @@ module Bundler "application for all non-root users on this machine.", :wrap => true end + def warn_if_outdated + return if ENV["BUNDLE_POSTIT_TRAMPOLINING_VERSION"].nil? + installed_version = Gem::Version.new(ENV["BUNDLE_POSTIT_TRAMPOLINING_VERSION"]) + running_version = Gem::Version.new(Bundler::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 " \ + "project uses #{running_version}. To update, run `bundle update " \ + "--bundler`. You won't see this message again unless you upgrade " \ + "to a newer version of Bundler.", :wrap => true + end + end + def confirm_without_groups return unless Bundler.settings.without.any? require "bundler/cli/common" diff --git a/lib/bundler/postit_trampoline.rb b/lib/bundler/postit_trampoline.rb index 90d5d97f..643822f6 100644 --- a/lib/bundler/postit_trampoline.rb +++ b/lib/bundler/postit_trampoline.rb @@ -49,9 +49,11 @@ rescue LoadError, NameError nil end -if installed_version.to_s != running_version.to_s - puts <<-WARN -You're running Bundler #{installed_version.to_s} but this project uses #{running_version.to_s}. To update, run `bundle update --bundler`. You won't see this message again unless you upgrade to a newer version of Bundler.\n +if Gem::Version.new(running_version) >= Gem::Version.new("1.13.0.pre.1") + ENV["BUNDLE_POSTIT_TRAMPOLINING_VERSION"] = installed_version.to_s +else + puts <<-WARN.strip +You're running Bundler #{installed_version} but this project uses #{running_version}. To update, run `bundle update --bundler`.\n WARN end |