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
|
# File 'lib/cuketagger/tagger.rb', line 9
def execute(args)
abort(USAGE) if args.empty? || args.first =~ /^(-h|--help)$/
force = false
args.each do |arg|
case arg
when /^-v|--version$/
puts CukeTagger::Version
when /^(.+?\.feature)((:\d+)*)$/
add_feature $1, $2.to_s
when /^(add|remove):(.+?)$/
alterations << [$1.to_sym, $2]
when /^(replace):(.+?):(.+)$/
alterations << [$1.to_sym, [$2, $3]]
when /^(-f|--force)$/
force = true
else
abort(USAGE)
end
end
alterations.uniq!
files = features_to_change.map { |file, line| file }.uniq
files.each { |file| parse file, force }
end
|