class Suppository::CommandRunner
Public Class Methods
new(command, arguments = '')
click to toggle source
# File lib/suppository/command_runner.rb, line 8 def initialize(command, arguments = '') @command = command @arguments = arguments end
Public Instance Methods
run()
click to toggle source
# File lib/suppository/command_runner.rb, line 13 def run assert_exists run_command end
Private Instance Methods
assert_exists()
click to toggle source
# File lib/suppository/command_runner.rb, line 20 def assert_exists `which "#{@command}"` message = "'#{@command}' was not found." raise(CommandMissingError, message) unless $CHILD_STATUS.success? end
run_command()
click to toggle source
# File lib/suppository/command_runner.rb, line 26 def run_command output = `#{@command} #{@arguments} 2>&1` raise(CommandError, output) unless $CHILD_STATUS.success? output end