diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bundler/cli.rb | 22 | ||||
-rw-r--r-- | lib/bundler/settings.rb | 3 |
2 files changed, 24 insertions, 1 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index eb9362a5..a70d66f2 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -13,6 +13,7 @@ module Bundler Bundler.ui = UI::Shell.new raise e ensure + warn_on_outdated_bundler Bundler::SharedHelpers.print_major_deprecations! end @@ -579,5 +580,26 @@ module Bundler command.reject!(&:empty?) Bundler.ui.info "Running `#{command * " "}` with bundler #{Bundler::VERSION}" end + + def self.warn_on_outdated_bundler + return if Bundler.settings[:disable_version_check] + + latest = Fetcher::CompactIndex. + new(nil, Source::Rubygems::Remote.new(URI("https://rubygems.org")), nil). + send(:compact_index_client). + instance_variable_get(:@cache). + dependencies("bundler"). + map {|d| Gem::Version.new(d.first) }. + max + return unless latest + + current = Gem::Version.new(VERSION) + return if current >= latest + + Bundler.ui.warn "The latest bundler is #{latest}, but you are currently running #{current}.\nTo update, run `gem install bundler#{" --pre" if latest.prerelease?}`" + rescue + nil + end + private_class_method :warn_on_outdated_bundler end end diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb index 35ad17ae..b2136384 100644 --- a/lib/bundler/settings.rb +++ b/lib/bundler/settings.rb @@ -11,6 +11,8 @@ module Bundler disable_exec_load disable_local_branch_check disable_shared_gems + disable_version_check + force_ruby_platform frozen gem.coc gem.mit @@ -18,7 +20,6 @@ module Bundler major_deprecations no_install no_prune - force_ruby_platform only_update_to_newer_versions plugins silence_root_warning |