freegenie-redgreen 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown ADDED
@@ -0,0 +1,3 @@
1
+ # freegenie-redgreen
2
+
3
+
data/Rakefile ADDED
@@ -0,0 +1,25 @@
1
+ require 'rake'
2
+
3
+ $LOAD_PATH.unshift('lib')
4
+
5
+ begin
6
+ require 'jeweler'
7
+ Jeweler::Tasks.new do |gem|
8
+ gem.name = "redgreen"
9
+ gem.summary = "freegenie-redgreen colourises windows console output for tests."
10
+ gem.email = "freegenie@gmail.com"
11
+ gem.homepage = "http://github.com/freegenie/redgreen"
12
+ gem.description = "freegenie-redgreen colourises windows console output for tests. This version works with ZenTest 4.0.0, autotest, snarl, XP and Vista. Please see the README file for setup or issues with Snarl."
13
+ gem.authors = ["Pat Eyler", "Chris Wanstrath", "Luke Pearce"]
14
+ end
15
+ rescue LoadError
16
+ puts "Jeweler, or one of its dependencies, is not available. Install it with: gem install jeweler"
17
+ end
18
+
19
+ require 'rake/rdoctask'
20
+ Rake::RDocTask.new do |rdoc|
21
+ rdoc.rdoc_dir = 'rdoc'
22
+ rdoc.title = 'freegenie-redgreen'
23
+ rdoc.rdoc_files.include('README.markdown')
24
+ rdoc.rdoc_files.include('lib/**/*.rb')
25
+ end
data/bin/rg ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ require 'rubygems'
3
+ require 'redgreen'
4
+ require 'win32console' if PLATFORM =~ /win32/
5
+
6
+ require $0 = ARGV.first
@@ -0,0 +1,4 @@
1
+ Autotest.send(:alias_method, :real_ruby, :ruby)
2
+ Autotest.send(:define_method, :ruby) do |*args|
3
+ real_ruby + %[ -rrubygems -e "require 'redgreen'" ]
4
+ end
data/lib/redgreen.rb ADDED
@@ -0,0 +1,79 @@
1
+ if ARGV.size > 0 and ARGV[0].include? 'test'
2
+ require 'test/unit'
3
+ require 'test/unit/ui/console/testrunner'
4
+
5
+ # cute.
6
+ module RedGreen
7
+ module Color
8
+ # # 37 = white, 30 = black
9
+ # FG_COLORS = { :for_clear => 37, :for_red => 37, :for_green => 37, :for_yellow => 30}
10
+ # BG_COLORS = { :clear => 0, :red => 41, :green => 42, :yellow => 43 }
11
+ # def self.method_missing(color_name, *args)
12
+ # color(color_name) + args.first + color(:clear)
13
+ # end
14
+ # def self.color(color)
15
+ # fg_color = FG_COLORS["for_#{color}".to_sym]
16
+ # bg_color = BG_COLORS[color.to_sym]
17
+ # "\e[#{fg_color};#{bg_color}m"
18
+ # end
19
+ COLORS = { :clear => 0, :red => 31, :green => 32, :yellow => 33 }
20
+ def self.method_missing(color_name, *args)
21
+ color(color_name) + args.first + color(:clear)
22
+ end
23
+ def self.color(color)
24
+ "\e[#{COLORS[color.to_sym]}m"
25
+ end
26
+ end
27
+ end
28
+
29
+ class Test::Unit::UI::Console::RedGreenTestRunner < Test::Unit::UI::Console::TestRunner
30
+ def initialize(suite, output_level=NORMAL, io=$stdout)
31
+ super
32
+ end
33
+
34
+ def output_single(something, level=NORMAL)
35
+ return unless (output?(level))
36
+ something = case something
37
+ when '.' then RedGreen::Color.green('.')
38
+ when 'F' then RedGreen::Color.red("F")
39
+ when 'E' then RedGreen::Color.yellow("E")
40
+ else something
41
+ end
42
+ @io.write(something)
43
+ @io.flush
44
+ end
45
+ end
46
+
47
+ class Test::Unit::AutoRunner
48
+ alias :old_initialize :initialize
49
+ def initialize(standalone)
50
+ old_initialize(standalone)
51
+ @runner = proc do |r|
52
+ Test::Unit::UI::Console::RedGreenTestRunner
53
+ end
54
+ end
55
+ end
56
+
57
+ class Test::Unit::TestResult
58
+ alias :old_to_s :to_s
59
+ def to_s
60
+ if old_to_s =~ /\d+ tests, \d+ assertions, (\d+) failures, (\d+) errors/
61
+ RedGreen::Color.send($1.to_i != 0 || $2.to_i != 0 ? :red : :green, $&)
62
+ end
63
+ end
64
+ end
65
+
66
+ class Test::Unit::Failure
67
+ alias :old_long_display :long_display
68
+ def long_display
69
+ old_long_display.sub('Failure', RedGreen::Color.red('Failure'))
70
+ end
71
+ end
72
+
73
+ class Test::Unit::Error
74
+ alias :old_long_display :long_display
75
+ def long_display
76
+ old_long_display.sub('Error', RedGreen::Color.yellow('Error'))
77
+ end
78
+ end
79
+ end
data/redgreen.gemspec ADDED
@@ -0,0 +1,42 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{redgreen}
5
+ s.version = "0.1.5"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Pat Eyler", "Chris Wanstrath", "Luke Pearce"]
9
+ s.date = %q{2009-06-01}
10
+ s.default_executable = %q{rg}
11
+ s.description = %q{redgreen colourises windows console output for tests. This version works with ZenTest 4.0.0, autotest, snarl, XP and Vista. Please see the README file for setup or issues with Snarl.}
12
+ s.email = %q{freegenie@gmail.com}
13
+ s.executables = ["rg"]
14
+ s.extra_rdoc_files = [
15
+ "README.markdown"
16
+ ]
17
+ s.files = [
18
+ "README.markdown",
19
+ "Rakefile",
20
+ "bin/rg",
21
+ "lib/redgreen.rb",
22
+ "lib/redgreen/autotest.rb",
23
+ "redgreen.gemspec",
24
+ "version.yml"
25
+ ]
26
+ s.has_rdoc = true
27
+ s.homepage = %q{http://github.com/freegenie/redgreen}
28
+ s.rdoc_options = ["--charset=UTF-8"]
29
+ s.require_paths = ["lib"]
30
+ s.rubygems_version = %q{1.3.1}
31
+ s.summary = %q{redgreen colourises windows console output for tests.}
32
+
33
+ if s.respond_to? :specification_version then
34
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
35
+ s.specification_version = 2
36
+
37
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
38
+ else
39
+ end
40
+ else
41
+ end
42
+ end
data/version.yml ADDED
@@ -0,0 +1,4 @@
1
+ ---
2
+ :minor: 5
3
+ :patch: 1
4
+ :major: 0
metadata ADDED
@@ -0,0 +1,61 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: freegenie-redgreen
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.5
5
+ platform: ruby
6
+ authors:
7
+ - Pat Eyler
8
+ - Chris Wanstrath
9
+ - Luke Pearce
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+
14
+ date: 2009-06-01 00:00:00 -07:00
15
+ default_executable: rg
16
+ dependencies: []
17
+
18
+ description: redgreen colourises windows console output for tests. This version works with ZenTest 4.0.0, autotest, snarl, XP and Vista. Please see the README file for setup or issues with Snarl.
19
+ email: freegenie@gmail.com
20
+ executables:
21
+ - rg
22
+ extensions: []
23
+
24
+ extra_rdoc_files:
25
+ - README.markdown
26
+ files:
27
+ - README.markdown
28
+ - Rakefile
29
+ - bin/rg
30
+ - lib/redgreen.rb
31
+ - lib/redgreen/autotest.rb
32
+ - redgreen.gemspec
33
+ - version.yml
34
+ has_rdoc: true
35
+ homepage: http://github.com/freegenie/redgreen
36
+ post_install_message:
37
+ rdoc_options:
38
+ - --charset=UTF-8
39
+ require_paths:
40
+ - lib
41
+ required_ruby_version: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: "0"
46
+ version:
47
+ required_rubygems_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: "0"
52
+ version:
53
+ requirements: []
54
+
55
+ rubyforge_project:
56
+ rubygems_version: 1.2.0
57
+ signing_key:
58
+ specification_version: 2
59
+ summary: redgreen colourises windows console output for tests.
60
+ test_files: []
61
+