#!/usr/bin/env ratch

# Load check all libs.
#
# Simply load each lib to make sure
# it doesn't fail.

require 'benchmark'

$:.unshift('lib')

scripts_core, scripts_more = [], []
Dir.chdir('lib') do
  scripts_more = glob('facets/*.rb')
  scripts_more.collect!{ |s| File.expand_path(s) }
  scripts_more.uniq!

  scripts_core = glob('facets/*/*.rb')
  scripts_core.collect!{ |s| File.expand_path(s) }
  scripts_core.uniq!
end

$VERBOSE = nil

def require_scripts(scripts)
  scripts.each do |file|
    begin
      require file
    rescue Exception => e
      puts file
      puts e.message
    end
  end
end

Benchmark.bm do |x|
  x.report("core"){ require_scripts(scripts_core) }
  x.report("more"){ require_scripts(scripts_more) }
end

