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
|
# File 'lib/snapdragon/command_line_parser.rb', line 7
def self.parse(args)
options = OpenStruct.new
options.format = "console"
options.color = true
options.pattern = "spec/**/*_spec.js"
options.jasmine_ver = "2"
opts = OptionParser.new do |opts|
opts.banner = "Usage: snapdragon [options] [files or directories]"
opts.on('-v', '--version', "Show the current version of this gem") do
puts "#{Snapdragon::VERSION}"; exit
end
opts.on('-h', '--help', "show usage") do
puts opts; exit
end
opts.on('-f', '--format [FORMAT]', "set output format") do |format|
options.format = format
end
opts.on('-N', "--nocolor", '--nocolour', 'Enable color in the output.') do
options.color = false
end
opts.on('-P', '--pattern PATTERN', 'Load files matching pattern (default: "spec/**/*_spec.js").') do |pattern|
options.pattern = pattern
end
opts.on('-J1', '--jasminev1', 'Use Jasmine v1.3.1 instead of the default v2.x.') do
options.jasmine_ver = "1"
end
end
opts.parse!(args)
options
end
|