lib/evrone/ci/router/build.rb in evrone-ci-router-0.2.0.pre4 vs lib/evrone/ci/router/build.rb in evrone-ci-router-0.2.0.pre5

- old
+ new

@@ -12,30 +12,31 @@ include Router::Helper::Logger include Router::Helper::Config attr_reader :message, :output, :output_counter - attr_accessor :jobs_count, :commit_info + attr_accessor :jobs_count def initialize(perform_build_message) @output_counter = 0 - @output = '' + @output = Common::OutputBuffer.new(&method(:publish_build_log_message)) @message = perform_build_message end + def release + output.close + end + def to_perform_job_message(travis, job_id) - script_builder = travis.to_script_builder - sha = (commit_info && commit_info.sha) || message.sha + script_builder = travis.to_script_builder(self) job_message = Message::PerformJob.new( id: message.id, name: message.name, - src: message.src, - sha: sha, - deploy_key: message.deploy_key, job_id: job_id, before_script: script_builder.to_before_script, script: script_builder.to_script, + after_script: script_builder.to_after_script, matrix_keys: travis.matrix_keys, ) job_message end @@ -45,38 +46,34 @@ build_id: message.id, status: status, tm: tm.to_i, jobs_count: jobs_count || 0, } - - if commit_info - attributes.merge!( - commit_author: commit_info.author, - commit_author_email: commit_info.email, - commit_sha: commit_info.sha, - commit_message: commit_info.message - ) - end Message::BuildStatus.new attributes end def add_to_output(str) output << str logger.debug str.strip if logger.level == 0 - BuildLogsConsumer.publish create_build_log_message(str) end def add_command_to_output(cmd) add_to_output "$ #{cmd}\n" end - def create_build_log_message(data) + def publish_build_log_message(str) @output_counter += 1 - Message::BuildLog.new( + log = Message::BuildLog.new( build_id: message.id, - tm: @output_counter, - log: data + tm: output_counter, + log: str ) + BuildLogsConsumer.publish log + log + end + + def scm_class + Evrone::CI::SCM::Git end end end end