class Rigit::Commands::Update::UpdateHandler

Attributes

args[R]
rig_name[R]

Public Class Methods

new(args) click to toggle source
# File lib/rigit/commands/update.rb, line 12
def initialize(args)
  @args = args
  @rig_name = args['RIG']
end

Public Instance Methods

execute() click to toggle source
# File lib/rigit/commands/update.rb, line 17
def execute
  verify_dirs
  update
end

Private Instance Methods

rig() click to toggle source
# File lib/rigit/commands/update.rb, line 36
def rig
  @rig ||= Rigit::Rig.new rig_name
end
target_path() click to toggle source
# File lib/rigit/commands/update.rb, line 40
def target_path
  @target_path ||= rig.path
end
update() click to toggle source
# File lib/rigit/commands/update.rb, line 24
def update
  say "Updating !txtgrn!#{rig_name}"
  success = Rigit::Git.pull target_path
  if success
    say "Rig updated !txtgrn!successfully!txtrst!"
  else
    # :nocov:
    say "!txtred!Update failed"
    # :nocov:
  end
end
verify_dirs() click to toggle source
# File lib/rigit/commands/update.rb, line 44
def verify_dirs
  if !rig.exist?
    say "Rig !txtgrn!#{rig_name}!txtrst! is not installed"
    raise Rigit::Exit
  end
end