Sha256: 5daa932a8ee4b749f41cc63e19ea96bf712e444c994a4350156e7b4b98ab128d

Contents?: true

Size: 1.19 KB

Versions: 4

Compression:

Stored size: 1.19 KB

Contents

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

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

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('--do-work OPTIONS', Array, 'INTERNAL USE ONLY') do |args|
    specs_to_run = args[3..-1]
    options[:worker_args] = args[0], args[1], args[2], specs_to_run
  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!

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
specjour-0.1.4 bin/specjour
specjour-0.1.3 bin/specjour
specjour-0.1.2 bin/specjour
specjour-0.1.1 bin/specjour