Skip to content

Commit

Permalink
rename project to testr and reimplement everything
Browse files Browse the repository at this point in the history
  • Loading branch information
sunaku committed Oct 9, 2011
1 parent e8a876a commit 16ab1e1
Show file tree
Hide file tree
Showing 23 changed files with 601 additions and 544 deletions.
4 changes: 4 additions & 0 deletions .gitignore
@@ -0,0 +1,4 @@
*.gem
.bundle
Gemfile.lock
pkg/*
4 changes: 4 additions & 0 deletions Gemfile
@@ -0,0 +1,4 @@
source "http://rubygems.org"

# Specify your gem's dependencies in testr.gemspec
gemspec
284 changes: 120 additions & 164 deletions README.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Rakefile
@@ -0,0 +1 @@
require "bundler/gem_tasks"
4 changes: 0 additions & 4 deletions bin/test-loop

This file was deleted.

55 changes: 55 additions & 0 deletions bin/testr
@@ -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
4 changes: 4 additions & 0 deletions bin/testr-driver
@@ -0,0 +1,4 @@
#!/usr/bin/env ruby
require 'testr/driver'
TestR::Driver.loop
Process.waitall
9 changes: 9 additions & 0 deletions bin/testr-herald
@@ -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
4 changes: 4 additions & 0 deletions bin/testr-master
@@ -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

0 comments on commit 16ab1e1

Please sign in to comment.