class ShellCommand
Public Class Methods
do_command(command)
click to toggle source
# File lib/shell_commands/shell_command.rb, line 31 def self.do_command(command) if !raw_do_command(command) if @@error_proc.nil? raise ShellCommandFailure.new(@@last_result) else @@error_proc.call(@@last_result) end return false end return true end
error_proc()
click to toggle source
# File lib/shell_commands/shell_command.rb, line 10 def self.error_proc @@error_proc end
last_result()
click to toggle source
# File lib/shell_commands/shell_command.rb, line 7 def self.last_result @@last_result end
raw_do_command(command)
click to toggle source
# File lib/shell_commands/shell_command.rb, line 17 def self.raw_do_command(command) result = %x[#{command} 2>&1] while not $?.exited? do end @@last_result = { "command" => command, "result" => result, "success" => $?.success? } @@results << @@last_result return $?.success? end
results()
click to toggle source
# File lib/shell_commands/shell_command.rb, line 13 def self.results @@results end