lib/evrone/ci/router.rb in evrone-ci-router-0.2.0.pre22 vs lib/evrone/ci/router.rb in evrone-ci-router-0.2.0.pre23
- old
+ new
@@ -2,23 +2,22 @@
require 'pathname'
require 'fileutils'
require 'thread'
require 'evrone/ci/common/error_notifier'
+require 'evrone/ci/build_configuration'
require File.expand_path("../..", __FILE__) + "/ci/router/ext/string.rb"
require File.expand_path("../..", __FILE__) + "/ci/router/ext/array.rb"
module Evrone
module CI
class Router
autoload :Configuration, File.expand_path("../router/configuration", __FILE__)
autoload :Build, File.expand_path("../router/build", __FILE__)
- autoload :BuildMatrix, File.expand_path("../router/build_matrix", __FILE__)
autoload :ScriptBuilder, File.expand_path("../router/script_builder", __FILE__)
- autoload :Travis, File.expand_path("../router/travis", __FILE__)
autoload :CLI, File.expand_path("../router/cli", __FILE__)
autoload :BuildLogsConsumer, File.expand_path("../router/consumers/build_logs_consumer", __FILE__)
autoload :BuildStatusConsumer, File.expand_path("../router/consumers/build_status_consumer", __FILE__)
autoload :BuildsConsumer, File.expand_path("../router/consumers/builds_consumer", __FILE__)
@@ -68,45 +67,45 @@
end
include Helper::Logger
include Helper::Config
- attr_reader :build, :travis
+ attr_reader :build, :configuration
def initialize(build)
- @build = build
- @travis = nil
+ @build = build
+ @configuration = nil
end
def perform
log_build do
update_build_status do
- load_travis &&
+ load_configuration &&
create_and_delivery_build_matrix
end
end
build.release
end
def create_and_delivery_build_matrix
- matrix = BuildMatrix.new travis
- build.jobs_count = matrix.travises.size
+ matrix = BuildConfiguration::Matrix.new configuration
+ build.jobs_count = matrix.configurations.size
- matrix.travises.each_with_index do |travis, idx|
+ matrix.configurations.each_with_index do |c, idx|
number = idx + 1
- message = build.to_perform_job_message travis, number
- logger.info "delivery job #{message.id}.#{number} #{travis.to_matrix_s}"
+ message = build.to_perform_job_message c, number
+ logger.info "delivery job #{message.id}.#{number} #{c.to_matrix_s}"
JobsConsumer.publish message
- publish_job_status_message build, travis, number
+ publish_job_status_message build, c, number
end
true
end
- def load_travis
- @travis = Travis.from_yaml build.message.travis
- @travis
+ def load_configuration
+ @configuration = BuildConfiguration.from_yaml build.message.travis
+ @configuration
end
def log_build
logger.tagged("build #{build.message.id}") do
logger.info "starting build"