class HTML::Proofer

def self.create_nokogiri(path)

def self.create_nokogiri(path)
  Nokogiri::HTML(File.read(path))
end

def get_checks

def get_checks
  HTML::Proofer::Checks::Check.subclasses
end

def initialize(src, opts = {:ext => ".html"})

def initialize(src, opts = {:ext => ".html"})
  @srcDir = src
  @options = opts
end

def print_issues(issues)

def print_issues(issues)
  return if issues.empty?
  issues.each do |issue|
    $stderr.puts issue + "\n\n"
  end
end

def run

def run
  Find.find(@srcDir) do |path|
    if File.extname(path) == @options[:ext]
      html = HTML::Proofer.create_nokogiri(path)
      issues = run_checks(path, html)
      self.print_issues(issues)
    end
  end
end

def run_checks(path, html)

def run_checks(path, html)
  issues = []
  get_checks.each do |klass|
    puts "Running #{klass.name.split(/:/).pop()} check... "
    check = klass.new(path, html)
    check.run
    issues.concat(check.issues)
  end
  issues
end