Sha256: fffbaef9a4967c80d3689bb588767e24bfbdbbe13c0e858523eed924f1391313

Contents?: true

Size: 866 Bytes

Versions: 22

Compression:

Stored size: 866 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
    Gem::Specification.outdated.sort.each do |name|
      local   = Gem::Specification.find_all_by_name(name).max
      dep     = Gem::Dependency.new local.name, ">= #{local.version}"
      remotes, _ = Gem::SpecFetcher.fetcher.spec_for_dependency dep

      next if remotes.empty?

      remotes.sort! { |a,b| a[0].version <=> b[0].version }

      highest = remotes.last.first

      say "#{local.name} (#{local.version} < #{highest.version})"
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
rubygems-update-2.0.17 lib/rubygems/commands/outdated_command.rb
rubygems-update-2.0.16 lib/rubygems/commands/outdated_command.rb
rubygems-update-2.0.15 lib/rubygems/commands/outdated_command.rb
rubygems-update-2.0.14 lib/rubygems/commands/outdated_command.rb
rubygems-update-2.0.13 lib/rubygems/commands/outdated_command.rb
rubygems-update-2.0.12 lib/rubygems/commands/outdated_command.rb
rubygems-update-2.0.11 lib/rubygems/commands/outdated_command.rb
rubygems-update-2.0.10 lib/rubygems/commands/outdated_command.rb
rubygems-update-2.0.9 lib/rubygems/commands/outdated_command.rb
rubygems-update-2.0.8 lib/rubygems/commands/outdated_command.rb
rubygems-update-2.0.7 lib/rubygems/commands/outdated_command.rb
rubygems-update-2.0.6 lib/rubygems/commands/outdated_command.rb
rubygems-update-2.0.5 lib/rubygems/commands/outdated_command.rb
rubygems-update-2.0.4 lib/rubygems/commands/outdated_command.rb
rubygems-update-2.0.3 lib/rubygems/commands/outdated_command.rb
rubygems-update-2.0.2 lib/rubygems/commands/outdated_command.rb
rubygems-update-2.0.0 lib/rubygems/commands/outdated_command.rb
rubygems-update-2.0.0.rc.2 lib/rubygems/commands/outdated_command.rb
rubygems-update-2.0.0.rc.1 lib/rubygems/commands/outdated_command.rb
rubygems-update-2.0.0.preview2.2 lib/rubygems/commands/outdated_command.rb