Module: WWTD::CLI

Defined in:
lib/wwtd/cli.rb

Constant Summary collapse

INFO_MAX_CHARACTERS =
30
STATE_COLOR_MAP =
{:start => :yellow, :success => :green}
ASCII_COLORS =
{:red => 31, :green => 32, :yellow => 33}

Class Method Summary collapse

Class Method Details

.run(argv = []) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/wwtd/cli.rb', line 8

def run(argv=[])
  # Read travis.yml
  matrix, ignored = ::WWTD.read_travis_yml
  puts "Ignoring: #{ignored.sort.join(", ")}" if ignored.any?

  # Execute tests
  results = protect_against_nested_runs do
    ::WWTD.run(matrix, parse_options(argv)) do |state, config|
      puts info_line(state, config, matrix)
    end
  end

  # Summary
  if results.size > 1
    puts "\nResults:"
    puts results.map { |state, config| info_line(state, config, matrix) }
  end

  results.all? { |state, config| state == :success } ? 0 : 1
end