class Tryouts::CLI::Run
def run
$ sergeant run [path/2/tryouts]
def run Tryouts.enable_debug if Drydock.debug? Tryouts.verbose = @global.verbose puts "#{Tryouts.sysinfo.to_s} (#{RUBY_VERSION})" if Tryouts.verbose > 0 load_available_tryouts_files passed, failed = 0, 0 Tryouts.instances.each_pair do |group,tryouts_inst| puts '', ' %-60s'.att(:reverse) % group puts " #{tryouts_inst.paths.join("\n ")}" if Tryouts.verbose > 0 tryouts_inst.tryouts.each_pair do |name,to| to.run to.report STDOUT.flush passed += to.passed failed += to.failed end end unless @global.quiet if (passed == 0 && failed == 0) puts DEV if Tryouts.verbose > 4 msg = " You didn't even try to acheive your dreams :[ " elsif failed == 0 puts PUG if Tryouts.verbose > 4 msg = passed > 1 ? "All %s dreams" : "Your only dream" msg = (" #{msg} came true " % [passed+failed]).color(:green) else puts BUG if Tryouts.verbose > 4 score = (passed.to_f / (passed.to_f+failed.to_f)) * 100 msg = " %s of %s dreams came true (%d%%) ".color(:red) msg = msg % [passed, passed+failed, score.to_i] end puts $/, msg.att(:reverse) end end