35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
# File 'lib/micron/app/options.rb', line 35
def self.parse_opts(options, argv)
parser = OptionParser.new do |opts|
opts.banner = "usage: #{$0} [options]"
opts.on("-t", "--test PATTERN", "Only run test files matching pattern") do |p|
options[:tests] << p
end
opts.on("-m", "--method PATTERN", "Only run test methods matching pattern") do |p|
p.strip!
options[:methods] << p if not p.empty?
end
opts.on("--nocov", "Disable coverage reporting") {
options[:coverage] = false
}
opts.on("--proc", "Use the process runner") {
options[:proc] = true
}
opts.on("--fork", "Use the forking runner") {
options[:fork] = true
}
opts.on("--runclass", "Run class in child process") {
options[:runclass] = true
}
opts.on("--runmethod", "Run method in child process") {
options[:runmethod] = true
}
opts.on("-h", "--help", "Show this message") do
puts opts
exit
end
end
begin
parser.parse!(argv)
rescue Exception => ex
exit if ex.kind_of? SystemExit
STDERR.puts "error: #{ex}"
STDERR.puts
STDERR.puts parser
exit 1
end
return options
end
|