#!/usr/bin/env ruby # Run unit tests def test live = ARGV.include?('--live') unless live $LOAD_PATH.unshift(File.expand_path('lib')) end puts "Ruby Version: #{RUBY_VERSION}" if find = ARGV.select{|e| e !~ /^[-]/ }[0] unless file?(find) find = File.join(find, '**', 'test_*.rb') end else find = 'test/**/test_*.rb' end files = Dir.glob(find) files.each do |file| next if File.directory?(file) begin puts "Loading: #{file}" if $DEBUG load(file) rescue LoadError puts "Error loading: #{file}" end end end # Go! if $0 == __FILE__ test end