Sha256: 2b64fb5c6543c91c88c40a1b2f3521fab6ae080d334119cc74acf77601a6368e
Contents?: true
Size: 1.19 KB
Versions: 2
Compression:
Stored size: 1.19 KB
Contents
require "buildem/base" require "buildem/condition_matcher" class BuildEm::Executor attr_accessor :argz def initialize(args, kernel=Kernel, matcher=BuildEm::ConditionMatcher.new) @kernel = kernel @argz ||= args @matcher = matcher end def name BuildEm::Executor end def run optz = argz[1] quit_on_error = (optz[:quit_on_error].nil? ? true : optz[:quit_on_error]) retry_amount = (optz[:retry_amount].nil? ? 1 : optz[:retry_amount]) condition = (optz[:retry_condition].nil? ? 0 : optz[:retry_condition]) executions = 0 begin puts "retrying command [#{argz[0]}]" if executions > 0 executions += 1 @comamnd_output = @kernel.run_command("#{argz[0]}") @command_exitstatus = @kernel.exitstatus match = @matcher.match(@command_exitstatus, @comamnd_output, condition) puts @comamnd_output if match return @command_exitstatus if match rescue Exception => e if quit_on_error raise e else #put to output log or specified log end end while executions < retry_amount @command_exitstatus end private def redirect_standard_error_and_out "" end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
buildem-0.0.5 | lib/buildem/executor.rb |
buildem-0.0.4 | lib/buildem/executor.rb |