#!/usr/bin/env ruby

$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../lib"))

require 'roodi'

runner = Roodi::Core::Runner.new

config_param = ARGV.detect {|arg| arg =~ /-config=.*/}
runner.config = config_param.split("=")[1] if config_param
ARGV.delete config_param

ARGV.each do |arg|
  Dir.glob(arg).each { |file| runner.check_file(file) }
end

runner.errors.each {|error| puts error}

puts "\nFound #{runner.errors.size} errors."

exit runner.errors.size