bin/excellent in simplabs-excellent-1.2.2 vs bin/excellent in simplabs-excellent-1.3.0
- old
+ new
@@ -5,31 +5,31 @@
require 'simplabs/excellent'
require 'pathname'
excellent = Simplabs::Excellent::Runner.new
+if ARGV.first =~ /html:[^\s]+/
+ begin
+ output = File.open(ARGV.first.sub(/html:/, ''), 'w+')
+ formatter = Simplabs::Excellent::Formatters::Html.new(output)
+ ARGV.shift
+ rescue
+ end
+else
+ formatter = Simplabs::Excellent::Formatters::Text.new
+end
+
if ARGV.empty?
puts "\n You must specify one or more directories to analyse, e.g.:\n"
puts "\n excellent app/\n\n"
exit 1
end
-ARGV.each do |arg|
- if File.file?(arg)
- excellent.check_file(arg)
- elsif File.directory?(arg)
- Dir.glob("#{arg}/**/*.rb").each { |file| excellent.check_file(file) }
- else
- puts "\n** Excellent cannot find '#{arg}'\n\n"
- exit 1
- end
+begin
+ excellent.check_paths(ARGV, formatter)
+rescue ArgumentError => ex
+ puts "EXCEPTION: #{ex.message}"
+ puts "\n** Excellent cannot find the paths specified!\n\n"
+ exit 1
end
-
-unless excellent.warnings.empty?
- puts "\n Warnings:\n\n"
- excellent.warnings.each do |warning|
- puts " * File #{warning.filename}, line #{warning.line_number}: #{warning.message}"
- end
-end
-puts "\n Found #{excellent.warnings.size} warnings.\n\n"
exit 0