Class: InchCI::Worker::Project::Build::HandleWorkerOutput

Inherits:
Object
  • Object
show all
Defined in:
lib/inch_ci/worker/project/build/handle_worker_output.rb

Instance Method Summary collapse

Constructor Details

#initialize(stdout, stderr, build = nil, save_service = SaveBuildData) ⇒ HandleWorkerOutput

Returns a new instance of HandleWorkerOutput.


9
10
11
12
13
14
15
16
17
# File 'lib/inch_ci/worker/project/build/handle_worker_output.rb', line 9

def initialize(stdout, stderr, build = nil, save_service = SaveBuildData)
  data = handle_stdout(stdout)
  if data && result = data['build']
    save_service.call(build, result, stderr)
  else
    debug = {:stdout => stdout, :stderr => stderr}
    raise "Running worker ".color(:red) + build.inspect.color(:cyan) +  " failed:".color(:red) + " #{debug.inspect}"
  end
end