Permalink
Browse files

rename project to testr and reimplement everything

  • Loading branch information...
1 parent e8a876a commit 16ab1e13ca44f99726c8337f834f81eb5825a6d2 @sunaku committed Oct 9, 2011
View
@@ -0,0 +1,4 @@
+*.gem
+.bundle
+Gemfile.lock
+pkg/*
View
@@ -0,0 +1,4 @@
+source "http://rubygems.org"
+
+# Specify your gem's dependencies in testr.gemspec
+gemspec
View
284 README.md

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -0,0 +1 @@
+require "bundler/gem_tasks"
View
@@ -1,4 +0,0 @@
-#!/usr/bin/env ruby
-require 'test/loop'
-Test::Loop.run
-raise SystemExit # prevent empty test suite run in master process
View
@@ -0,0 +1,55 @@
+#!/usr/bin/env ruby
+
+require 'json'
+require 'testr/client'
+
+@driver = TestR::Client::Transceiver.new('testr-driver') do |line|
+ event, *details = JSON.load(line)
+
+ case event = event.to_sym
+ when :load then warn 'testr: Overhead absorbed; Ready for testing!'
+ when :over then warn 'testr: Reabsorbing changed overhead files...'
+ else
+ test_file, test_names, *details = details
+ message = [event.upcase, test_file, test_names.inspect, details].join(' ')
+
+ color = case event
+ when :pass then "\e[32m%s\e[0m" # green
+ when :fail then "\e[31m%s\e[0m" # red
+ end
+ message = color % message if color and STDOUT.tty?
+ message = [message, File.read(test_file + '.log'), message] if event == :fail
+
+ puts message
+ end
+end
+
+COMMANDS = {
+ 'r' => :run_all_test_files,
+ 's' => :stop_running_test_files,
+ 'p' => :rerun_passed_test_files,
+ 'f' => :rerun_failed_test_files,
+ 'o' => :reabsorb_overhead_files,
+ 'q' => :quit,
+}
+
+def COMMANDS.show
+ each {|key, cmd| warn "testr: Type #{key} to #{cmd.to_s.tr('_', ' ')}." }
+end
+
+COMMANDS.show # instruct newbies
+
+while key = STDIN.gets.chomp
+ if command = COMMANDS[key]
+ if command == :quit
+ @driver.quit
+ break
+ else
+ @driver.send [command]
+ end
+ else
+ COMMANDS.show
+ end
+end
+
+Process.waitall
View
@@ -0,0 +1,4 @@
+#!/usr/bin/env ruby
+require 'testr/driver'
+TestR::Driver.loop
+Process.waitall
View
@@ -0,0 +1,9 @@
+#!/usr/bin/env ruby
+STDOUT.sync = true
+
+require 'guard'
+require 'guard/listener'
+
+listener = Guard::Listener.select_and_init
+listener.on_change {|files| puts files }
+listener.start
View
@@ -0,0 +1,4 @@
+#!/usr/bin/env ruby
+require 'testr/master'
+TestR::Master.loop
+raise SystemExit # prevent empty test suite from running in the master process
Oops, something went wrong.

0 comments on commit 16ab1e1

Please sign in to comment.