module Rudy::Routines::Handlers::Base

Public Instance Methods

keep_going?() click to toggle source
# File lib/rudy/routines/handlers/base.rb, line 31
def keep_going?
  Annoy.pose_question("  Keep going?\a ", /yes|y|ya|sure|you bet!/i, STDERR)
end
trap_rbox_errors(ret=nil, &command) click to toggle source
# File lib/rudy/routines/handlers/base.rb, line 7
def trap_rbox_errors(ret=nil, &command)
  begin
    ret = command.call if command
    return unless ret.is_a?(Rye::Rap)
    li '  ' << ret.stdout.join("#{$/}  ") if !ret.stdout.empty?
    print_response(ret)
  rescue IOError => ex
    le "  Connection Error (#{ex.message})".color(:red)
    choice = Annoy.get_user_input('(S)kip  (R)etry  (F)orce  (A)bort: ', nil, 3600) || ''
     if choice.match(/\AS/i)
       return
     elsif choice.match(/\AR/i)
       retry
     elsif choice.match(/\AF/i)
       @@global.force = true
       retry
     else
       exit 12
     end
  end
  
  ret
end

Private Instance Methods

print_response(rap) click to toggle source