Flowdock
method

which_to_update

Importance_0
v1_9_3_392 - Show latest stable - 0 notes - Class: UpdateCommand
which_to_update(highest_installed_gems, gem_names, system = false) public

No documentation

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

Hide source
# File lib/rubygems/commands/update_command.rb, line 200
  def which_to_update highest_installed_gems, gem_names, system = false
    result = []

    highest_installed_gems.each do |l_name, l_spec|
      next if not gem_names.empty? and
              gem_names.all? { |name| /#{name}/ !~ l_spec.name }

      dependency = Gem::Dependency.new l_spec.name, "> #{l_spec.version}"

      fetcher = Gem::SpecFetcher.fetcher
      spec_tuples = fetcher.find_matching dependency

      matching_gems = spec_tuples.select do |(name, _, platform),|
        name == l_name and Gem::Platform.match platform
      end

      highest_remote_gem = matching_gems.sort_by do |(_, version),|
        version
      end.last

      highest_remote_gem ||= [[nil, Gem::Version.new(0), nil]] # "null" object
      highest_remote_ver = highest_remote_gem.first[1]

      if system or (l_spec.version < highest_remote_ver) then
        result << [l_spec.name, [l_spec.version, highest_remote_ver].max]
      end
    end

    result
  end
Register or log in to add new notes.