def self.parse_options args = ARGV
require 'optparse'
options = {
:args => args.dup
}
OptionParser.new do |opts|
opts.banner = "Continuous testing for your ruby app.\n\nAutotest automatically tests code that has changed. It\nassumes the code is in lib, and tests are in tests. Autotest\nuses plugins to control what happens. You configure plugins\nwith require statements in the .autotest file in your\nproject base directory, and a default configuration for all\nyour projects in the .autotest file in your home directory.\n\nUsage:\nautotest [options]\n".gsub(/^ /, '')
opts.on "-f", "--fast-start", "Do not run full tests at start" do
options[:no_full_after_start] = true
end
opts.on("-c", "--no-full-after-failed",
"Do not run all tests on red->green") do
options[:no_full_after_failed] = true
end
opts.on "-v", "--verbose", "Be annoyingly verbose (debugs .autotest)." do
options[:verbose] = true
end
opts.on "-q", "--quiet", "Be quiet." do
options[:quiet] = true
end
opts.on("-r", "--rc CONF", String, "Override path to config file") do |o|
options[:rc] = Array(o)
end
opts.on("-s", "--style STYLE", String,
"Manually specify test style. (default: autodiscover)") do |style|
options[:style] = Array(style)
end
opts.on("-w", "--warnings", "Turn on ruby warnings") do
$-w = true
end
opts.on "-h", "--help", "Show this." do
puts opts
exit 1
end
end.parse! args
Autotest.options.merge! options
options
end