2019-06-20 19:59:01 -05:00
|
|
|
#!/usr/bin/env ruby
|
2019-06-20 20:33:22 -05:00
|
|
|
# frozen_string_literal: true
|
2019-06-20 19:59:01 -05:00
|
|
|
|
|
|
|
require './lib/turbo_tests'
|
|
|
|
require 'optparse'
|
|
|
|
|
|
|
|
requires = []
|
|
|
|
formatters = []
|
|
|
|
|
|
|
|
OptionParser.new do |opts|
|
|
|
|
opts.on("-r", "--require PATH", "Require a file.") do |filename|
|
|
|
|
requires << filename
|
|
|
|
end
|
|
|
|
|
|
|
|
opts.on("-f", "--format FORMATTER", "Choose a formatter.") do |name|
|
|
|
|
formatters << {
|
|
|
|
name: name,
|
|
|
|
outputs: []
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
opts.on("-o", "--out FILE", "Write output to a file instead of $stdout") do |filename|
|
|
|
|
if formatters.empty?
|
|
|
|
formatters << {
|
|
|
|
name: "progress",
|
|
|
|
outputs: []
|
|
|
|
}
|
|
|
|
end
|
|
|
|
formatters.last[:outputs] << filename
|
|
|
|
end
|
|
|
|
end.parse!(ARGV)
|
|
|
|
|
|
|
|
requires.each { |f| require(f) }
|
|
|
|
|
|
|
|
if formatters.empty?
|
|
|
|
formatters << {
|
|
|
|
name: "progress",
|
|
|
|
outputs: []
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
formatters.each do |formatter|
|
|
|
|
if formatter[:outputs].empty?
|
|
|
|
formatter[:outputs] << '-'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-06-20 20:33:22 -05:00
|
|
|
TurboTests::Runner.run(formatters, ARGV.empty? ? ["spec"] : ARGV)
|