Sha256: 3ea9aef25aba32daaebe6f66de2ffe20ddf629e153108fd37668a9ad24b19a2a

Contents?: true

Size: 1.51 KB

Versions: 6

Compression:

Stored size: 1.51 KB

Contents

#!/usr/bin/env ruby
require 'optparse'
require 'specjour'

options = {:worker_size => 1, :batch_size => 1}

optparse = OptionParser.new do |opts|
  opts.banner = "Usage: specjour [options]"

  opts.on('-w', '--workers WORKERS', Numeric, "Number of WORKERS to spin up, defaults to #{options[:worker_size]}") do |n|
    options[:worker_size] = n
  end

  opts.on('-b', '--batch-size [SIZE]', Integer, "Number of specs to run before reporting back to the dispatcher, defaults to #{options[:batch_size]}") do |n|
    options[:batch_size] = n
  end

  opts.on('-p', '--projects PROJECTS', Array, "Only run specs for these comma delimited project names, i.e. workbeast,taigan") do |project_names|
    options[:registered_projects] = project_names
  end

  opts.on('--do-work OPTIONS', Array, 'INTERNAL USE ONLY') do |args|
    options[:worker_args] = args[0], args[1], args[2]
  end

  opts.on('--log', TrueClass, 'print debug messages to stdout') do |val|
    Specjour.new_logger Logger::DEBUG
  end

  opts.on_tail('-v', '--version', 'Show the version of specjour') do
    abort Specjour::VERSION
  end

  opts.on_tail("-h", "--help", "Show this message") do
    summary = opts.to_a
    summary.first << "\n"
    abort summary.reject {|s| s =~ /INTERNAL/}.join
  end
end

optparse.parse!

abort(%(ERROR: I don't understand the following flags: "#{ARGV.join(', ')}")) if ARGV.any?

if options[:worker_args]
  options[:worker_args] << options[:batch_size]
  Specjour::Worker.new(*options[:worker_args]).run
else
  Specjour::Manager.new(options).start
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
specjour-0.1.18 bin/specjour
specjour-0.1.17 bin/specjour
specjour-0.1.16 bin/specjour
specjour-0.1.15 bin/specjour
specjour-0.1.14 bin/specjour
specjour-0.1.13 bin/specjour