Class: VimGet::Commands::UpgradeCommand

Inherits:
BaseCommand show all
Defined in:
lib/vimget/commands/upgrade_command.rb

Constant Summary

Constants inherited from BaseCommand

BaseCommand::PROGRAM

Instance Attribute Summary

Attributes inherited from BaseCommand

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

Instance Method Summary collapse

Methods inherited from BaseCommand

#invoke, #show_help

Constructor Details

#initializeUpgradeCommand

Returns a new instance of UpgradeCommand.



21
22
23
# File 'lib/vimget/commands/upgrade_command.rb', line 21

def initialize
  super('upgrade', 'upgrade outdated script(s)')
end

Instance Method Details

#argumentsObject



29
30
31
# File 'lib/vimget/commands/upgrade_command.rb', line 29

def arguments
  "SCRIPT  the name of script to upgrade"
end

#executeObject

do the upgrading action



34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/vimget/commands/upgrade_command.rb', line 34

def execute
  args = fetch_arguments
  outdated_scripts = VimGet.db.outdated_scripts
  
  if outdated_scripts.empty? 
    puts "There is no script outdated."
    return
  end
  
  installer = Installer.new(@options)
  outdated_scripts.each do |s|
    installer.upgrade(s)
  end
end

#usageObject



25
26
27
# File 'lib/vimget/commands/upgrade_command.rb', line 25

def usage
  "#{@program_name} [SCRIPT SCRIPT...]"
end