Class: CukeCIWorkers::Runner
- Defined in:
- lib/cuke_ci_workers/runner.rb
Instance Attribute Summary
Attributes inherited from Worker
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options) ⇒ Runner
constructor
A new instance of Runner.
- #run ⇒ Object
Constructor Details
#initialize(options) ⇒ Runner
Returns a new instance of Runner.
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/cuke_ci_workers/runner.rb', line 15 def initialize() @configuration_file_name = [:configuration_file_name] @configuration = YAML.load_file(@configuration_file_name) @poll_uri = URI.parse(@configuration['poll_url']) @push_url = @configuration['push_url'] @verbose = [:verbose] super(@configuration['log_file_name'], @configuration['log_level']) end |
Class Method Details
.parse!(args) ⇒ Object
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
# File 'lib/cuke_ci_workers/runner.rb', line 144 def parse!(args) default_runner_config_file_name = './cuke_ci_runner_config.yml' = {} opts = OptionParser.new do |opts| opts. = 'Usage: ...' opts.on("-c", "--configuration CONFIGURATION_FILE_NAME", "Path to configuration file. Defaults to '#{default_runner_config_file_name}'.") do |file_name| [:configuration_file_name] = file_name end opts.on("-v", "--verbose", "Be verbose") do |v| [:verbose] = true end opts.on_tail("-h", "--help", "Show this message") do puts opts exit end end opts.parse! [:configuration_file_name] ||= default_runner_config_file_name begin self.new() rescue puts "Could not open configuration file at '#{[:configuration_file_name]}'." exit end rescue OptionParser::ParseError puts opts exit end |
Instance Method Details
#run ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/cuke_ci_workers/runner.rb', line 27 def run $running = true Signal.trap('INT') { say('Exiting...') $running = false } while($running) do begin run_present = poll_for_run rescue Exception => e log_exception(e) end if run_present say('Found run.') begin pull_repo checkout_commit prepare if result = cucumber push_result(result) else push_error end rescue Exception => e log_exception(e) end else say('Nothing found. Going to sleep...') sleep 5 end end end |