197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
|
# File 'lib/pendaxes/command_line.rb', line 197
def run
quiet = false
path = Dir.pwd
reporter = :text
OptionParser.new do |opts|
opts.on('-q', '--quiet', 'Turn off progress output.') do
quiet = true
end
opts.on('-d DIR', '--repo DIR', 'Specify path to working copy of git.') do |dir|
path = dir
end
opts.on('-r REPORTER', '--reporter REPORTER', 'Specify reporter') do |name|
reporter = name.to_sym
end
opts.on_tail('--help', 'Show this help') do
return usage
end
end.parse!(@args)
if @args.empty?
return usage
end
workspace = Workspace.new(path: path)
files = workspace.dive do
@args.map { |pattern|
sub_files = Dir[pattern].map do |file_or_directory|
if FileTest.file?(file_or_directory)
file_or_directory
elsif FileTest.directory?(file_or_directory)
Dir[File.join(file_or_directory, '**', '*_spec.rb')]
end
end
if sub_files.empty?
abort "#{$0}: #{pattern}: No such file or directory"
end
sub_files
}.flatten.map { |_| File.expand_path(_) }
end
$stderr.puts '=> Detecting...' unless quiet
pendings = Detector.find(:rspec).new(workspace, out: quiet ? nil : $stderr, pattern: files).detect
$stderr.puts '=> Total Result:' unless quiet
notificator = Notificator.find(:terminal).new(
out: $stdout, include_allowed: true,
reporter: {use: reporter, include_allowed: true}
)
notificator.add pendings
notificator.notify
0
end
|