Flowdock
method

warn_on_outdated_bundler

Importance_0
v2_6_3 - Show latest stable - 0 notes - Class: CLI
  • 1_8_6_287
  • 1_8_7_72
  • 1_8_7_330
  • 1_9_1_378
  • 1_9_2_180
  • 1_9_3_125
  • 1_9_3_392
  • 2_1_10
  • 2_2_9
  • 2_4_6
  • 2_5_5
  • 2_6_3 (0)
  • What's this?
warn_on_outdated_bundler() private

No documentation

This method has no description. You can help the Ruby community by adding new notes.

Hide source
# File lib/bundler/cli.rb, line 756
    def warn_on_outdated_bundler
      return if Bundler.settings[:disable_version_check]

      command_name = current_command.name
      return if PARSEABLE_COMMANDS.include?(command_name)

      return unless SharedHelpers.md5_available?

      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
      latest_installed = Bundler.rubygems.find_name("bundler").map(&:version).max

      installation = "To install the latest version, run `gem install bundler#{" --pre" if latest.prerelease?}`"
      if latest_installed && latest_installed > current
        suggestion = "To update to the most recent installed version (#{latest_installed}), run `bundle update --bundler`"
        suggestion = "#{installation}\n#{suggestion}" if latest_installed < latest
      else
        suggestion = installation
      end

      Bundler.ui.warn "The latest bundler is #{latest}, but you are currently running #{current}.\n#{suggestion}"
    rescue RuntimeError
      nil
    end
Register or log in to add new notes.