Sha256: 46c3aaf5cb19426ba0e4524fba0b68550ed0ce256fb4ad8aa9eea222d82e68f4

Contents?: true

Size: 912 Bytes

Versions: 3

Compression:

Stored size: 912 Bytes

Contents

require 'rubygems/command'
require 'rubygems/local_remote_options'
require 'rubygems/spec_fetcher'
require 'rubygems/version_option'

class Gem::Commands::OutdatedCommand < Gem::Command

  include Gem::LocalRemoteOptions
  include Gem::VersionOption

  def initialize
    super 'outdated', 'Display all gems that need updates'

    add_local_remote_options
    add_platform_option
  end

  def execute
    # FIX: this should be able to be Gem.source_index but our test fails :(
    locals = Gem::SourceIndex.new Gem::SourceIndex.installed_spec_directories

    locals.outdated.sort.each do |name|
      local   = locals.find_name(name).last
      dep     = Gem::Dependency.new local.name, ">= #{local.version}"
      remotes = Gem::SpecFetcher.fetcher.fetch dep

      next if remotes.empty?

      remote = remotes.last.first
      say "#{local.name} (#{local.version} < #{remote.version})"
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rubygems-update-1.7.2 lib/rubygems/commands/outdated_command.rb
rubygems-update-1.7.1 lib/rubygems/commands/outdated_command.rb
rubygems-update-1.7.0 lib/rubygems/commands/outdated_command.rb