redgreen 1.2 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/bin/rg CHANGED
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'rubygems'
3
3
  require 'redgreen'
4
+ require 'win32console' if PLATFORM =~ /win32/
5
+
4
6
  require $0 = ARGV.first
@@ -1,4 +1,3 @@
1
- require 'Win32/Console/ANSI' if PLATFORM =~ /win32/
2
1
  require 'test/unit'
3
2
  require 'test/unit/ui/console/testrunner'
4
3
 
@@ -14,6 +13,10 @@ module Color
14
13
  end
15
14
 
16
15
  class Test::Unit::UI::Console::RedGreenTestRunner < Test::Unit::UI::Console::TestRunner
16
+ def initialize(suite, output_level=NORMAL, io=$stdout)
17
+ super
18
+ end
19
+
17
20
  def output_single(something, level=NORMAL)
18
21
  return unless (output?(level))
19
22
  something = case something
@@ -0,0 +1,43 @@
1
+ Autotest.send(:alias_method, :real_make_test_cmd, :make_test_cmd)
2
+ Autotest.send(:define_method, :make_test_cmd) do |*args|
3
+ real_make_test_cmd(*args).sub('test/unit', %[rubygems -e "require 'redgreen'"])
4
+ end
5
+
6
+ if PLATFORM =~ /win32/
7
+ require 'win32console'
8
+ Autotest.send(:define_method, :run_tests) do |*args|
9
+ find_files_to_test # failed + changed/affected
10
+ cmd = make_test_cmd @files_to_test
11
+
12
+ hook :run_command
13
+ puts cmd
14
+ old_sync = $stdout.sync
15
+ $stdout.sync = true
16
+ @results = []
17
+ line = []
18
+ begin
19
+ open("| #{cmd}", "r") do |f|
20
+ until f.eof? do
21
+ c = f.getc
22
+ #~ putc c
23
+ line << c
24
+ if c == ?\n then
25
+ @results << line.pack("c*")
26
+ line.clear
27
+ end
28
+ end
29
+ end
30
+ ensure
31
+ $stdout.sync = old_sync
32
+ end
33
+ puts @results
34
+ hook :ran_command
35
+ @results = @results.join
36
+ handle_results(@results)
37
+ end
38
+
39
+ Autotest.add_hook(:ran_command) do |at| p
40
+ include Term::ANSIColor
41
+ at.results = at.results.map{ |r| uncolored(r) }
42
+ end
43
+ end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: redgreen
5
5
  version: !ruby/object:Gem::Version
6
- version: "1.2"
7
- date: 2006-11-09 00:00:00 -08:00
6
+ version: 1.2.1
7
+ date: 2007-04-17 00:00:00 -07:00
8
8
  summary: redgreen is an expanded version of Pat Eyler's RedGreen
9
9
  require_paths:
10
10
  - lib
@@ -33,7 +33,9 @@ authors:
33
33
  files:
34
34
  - README
35
35
  - bin/rg
36
+ - lib/redgreen
36
37
  - lib/redgreen.rb
38
+ - lib/redgreen/autotest.rb
37
39
  - test/test_fake.rb
38
40
  test_files: []
39
41