#!/usr/bin/env ruby $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../lib")) require 'simplabs/excellent' require 'pathname' excellent = Simplabs::Excellent::Runner.new 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 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