Sha256: 347dd4a5a68e80a602f95c8c4c4957f8aebcfcbc647368a24ab4e22e00f0ebe1
Contents?: true
Size: 1.44 KB
Versions: 21
Compression:
Stored size: 1.44 KB
Contents
require 'optparse' require 'evrone/common/amqp' require 'evrone/ci/common/env_file' module Evrone module CI module Worker class CLI include Helper::Config include Helper::Logger include Common::EnvFile def initialize @options = {} parse! Worker.initialize! end def run trap('INT') { Thread.new do Evrone::Common::AMQP.shutdown end.join } Evrone::Common::AMQP::Supervisor::Threaded.build( Evrone::CI::Worker::JobsConsumer => config.workers, ).run end private def parse! OptionParser.new do |opts| opts.banner = "Usage: evrone-ci-worker [options]" opts.on("-w", "--workers NUM", "Number of workers, default 1") do |v| @options[:workers] = v.to_i end opts.on("-p", "--path PATH", "Working directory, default current directory") do |v| @options[:path_prefix] = v.to_s end opts.on("-c", "--config FILE", "Path to configuration file, default /etc/evrone/ci") do |v| @options[:config] = v end end.parse! read_env_file @options.delete(:config) @options.each_pair do |k,v| config.public_send("#{k}=", v) end end end end end end
Version data entries
21 entries across 21 versions & 1 rubygems