Class: Gem::OutdatedCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/rubygems/gem_commands.rb

Instance Attribute Summary

Attributes inherited from Command

#command, #defaults, #options, #program_name, #summary

Instance Method Summary collapse

Methods inherited from Command

add_common_option, #add_option, add_specific_extra_args, #arguments, common_options, #defaults_str, extra_args, extra_args=, #handles?, #invoke, #merge_options, #remove_option, #show_help, specific_extra_args, specific_extra_args_hash, #usage, #when_invoked

Methods included from DefaultUserInteraction

#ui, ui, #ui=, ui=, #use_ui, use_ui

Constructor Details

#initializeOutdatedCommand

Returns a new instance of OutdatedCommand.



331
332
333
# File 'lib/rubygems/gem_commands.rb', line 331

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

Instance Method Details

#executeObject



335
336
337
338
339
340
341
342
# File 'lib/rubygems/gem_commands.rb', line 335

def execute
  locals = Gem::SourceIndex.from_installed_gems
  locals.outdated.each do |name|
    local = locals.search(/^#{name}$/).last
    remote = Gem::SourceInfoCache.search(/^#{name}$/).last
    say "#{local.name} (#{local.version} < #{remote.version})"
  end
end