-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Renamed routine handlers to 'routines' (b/c that's what they are) and…
… helpers to handlers. That sentence is confusing but the code is absolutely less confusing now :]
- Loading branch information
Showing
17 changed files
with
167 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,6 @@ def deepest_point(h=self, steps=0) | |
end | ||
steps | ||
end | ||
|
||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
|
||
|
||
module Rudy; module Routines; module Handlers; | ||
module Base | ||
include Rudy::Huxtable | ||
|
||
def trap_rbox_errors(ret=nil, &command) | ||
begin | ||
ret = command.call if command | ||
return unless ret.is_a?(Rye::Rap) | ||
puts ' ' << ret.stdout.join("#{$/} ") if !ret.stdout.empty? | ||
print_response(ret) | ||
rescue IOError => ex | ||
STDERR.puts " Connection Error (#{ex.message})".color(:red) | ||
choice = Annoy.get_user_input('(S)kip (A)bort: ') || '' | ||
if choice.match(/\AS/i) | ||
return | ||
#elsif choice.match(/\AR/i) | ||
# retry | ||
else | ||
exit 12 | ||
end | ||
end | ||
|
||
ret | ||
end | ||
|
||
def keep_going? | ||
Annoy.pose_question(" Keep going?\a ", /yes|y|ya|sure|you bet!/i, STDERR) | ||
end | ||
|
||
|
||
private | ||
def print_response(rap) | ||
colour = rap.exit_code != 0 ? :red : :normal | ||
[:stderr].each do |sumpin| | ||
next if rap.send(sumpin).empty? | ||
STDERR.puts | ||
STDERR.puts((" #{sumpin.to_s.upcase} " << '-'*38).color(colour).bright) | ||
STDERR.puts " " << rap.send(sumpin).join("#{$/} ").color(colour) | ||
end | ||
STDERR.puts " Exit code: #{rap.exit_code}".color(colour) if rap.exit_code != 0 | ||
end | ||
|
||
end | ||
|
||
end; end; end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
|
||
module Rudy; module Routines; module Handlers; | ||
module Disks | ||
include Rudy::Routines::Handlers::Base | ||
extend self | ||
|
||
Rudy::Routines.add_handler :machines, self | ||
|
||
|
||
end | ||
end; end; end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.