6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# File 'lib/cellophane/options.rb', line 6
def self.parse(args)
default_options = self.get_options(:default)
project_options = self.get_options(:project)
merged_options = default_options.merge(project_options)
option_parser = OptionParser.new do |opts|
opts.banner = "Usage: cellophane [options] PATTERN"
opts.on('-r', '--regexp', 'PATTERN is a regular expression. Default is false.') do
merged_options[:regexp] = true
end
opts.on('-t', '--tags TAGS', 'Tags to include/exclude.') do |tags|
merged_options[:tags] = tags
end
opts.on('-c', '--cucumber OPTIONS', 'Options to pass to cucumber.') do |cucumber|
merged_options[:cucumber] = cucumber
end
opts.on('-p', '--print', 'Echo the command instead of calling cucumber.') do
merged_options[:print] = true
end
opts.on('-d', '--debug', 'Require ruby-debug.') do
require 'rubygems'
require 'ruby-debug'
end
opts.on( '-v', '--version', 'Display the version.' ) do
merged_options[:version] = true
end
opts.on( '-h', '--help', 'Display this screen.' ) do
puts opts
exit(0)
end
end
option_parser.parse!(args)
merged_options[:pattern] = args.first if args.any?
return self.normalize_options(merged_options)
end
|