mynyml-redgreen 0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright © 2009 Martin Aumont (mynyml)
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
4
+ this software and associated documentation files (the "Software"), to deal in
5
+ the Software without restriction, including without limitation the rights to
6
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7
+ of the Software, and to permit persons to whom the Software is furnished to do
8
+ so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
data/README ADDED
@@ -0,0 +1,38 @@
1
+ ==== Summary
2
+
3
+ Standalone redgreen eye candy for test results, ala autotest
4
+
5
+ Adds a visual cue at the end of a test run to better visualize whether test(s)
6
+ passed or failed.
7
+
8
+ Red if a test failed, Green if all tests passed. Simple.
9
+
10
+
11
+ ==== Usage
12
+
13
+ require 'redgreen'
14
+
15
+ Is all you need!
16
+
17
+ Place it in your test file (or test_helper.rb), and run your suite.
18
+
19
+
20
+ ==== Install
21
+
22
+ gem install mynyml-redgreen --source http://gems.github.com/
23
+
24
+
25
+ ==== Testing Framework Compatibility
26
+
27
+ * test/unit
28
+ * minitest/unit
29
+
30
+
31
+ ==== TODO
32
+
33
+ * Add test framework adapters
34
+ * contest # propably already works; need testing
35
+ * context # propably already works; need testing
36
+ * shoulda # propably already works; need testing
37
+ * expectations
38
+ * ...
data/Rakefile ADDED
@@ -0,0 +1,71 @@
1
+ # --------------------------------------------------
2
+ # based on thin's Rakefile (http://github.com/macournoyer/thin)
3
+ # --------------------------------------------------
4
+ require 'rake/gempackagetask'
5
+ require 'rake/rdoctask'
6
+ require 'pathname'
7
+ require 'yaml'
8
+
9
+ load 'test/tests.rake'
10
+ task :default => :test_all
11
+
12
+ RUBY_1_9 = RUBY_VERSION =~ /^1\.9/
13
+ WIN = (RUBY_PLATFORM =~ /mswin|cygwin/)
14
+ SUDO = (WIN ? "" : "sudo")
15
+
16
+ def gem
17
+ RUBY_1_9 ? 'gem19' : 'gem'
18
+ end
19
+
20
+ def all_except(res)
21
+ Dir['**/*'].reject do |path|
22
+ Array(res).any? {|re| path.match(re) }
23
+ end
24
+ end
25
+
26
+ spec = Gem::Specification.new do |s|
27
+ s.name = 'redgreen'
28
+ s.version = '0.5'
29
+ s.summary = "Standalone redgreen eye candy for test results, ala autotest"
30
+ s.description = "Standalone redgreen eye candy for test results, ala autotest"
31
+ s.author = "Martin Aumont"
32
+ s.email = 'mynyml@gmail.com'
33
+ s.homepage = ''
34
+ s.has_rdoc = true
35
+ s.require_path = "lib"
36
+ s.files = all_except([/doc/, /pkg/])
37
+ s.add_dependency 'mynyml-override', '>= 0.5'
38
+ s.add_dependency 'term-ansicolor', '>= 1.0.4'
39
+ end
40
+
41
+ desc "Generate rdoc documentation."
42
+ Rake::RDocTask.new("rdoc") { |rdoc|
43
+ rdoc.rdoc_dir = 'doc/rdoc'
44
+ rdoc.title = "RedGreen"
45
+ rdoc.options << '--line-numbers' << '--inline-source'
46
+ rdoc.options << '--charset' << 'utf-8'
47
+ rdoc.rdoc_files.include('README')
48
+ rdoc.rdoc_files.include('lib/**/*.rb')
49
+ }
50
+
51
+ Rake::GemPackageTask.new(spec) do |p|
52
+ p.gem_spec = spec
53
+ end
54
+
55
+ desc "Remove package products"
56
+ task :clean => :clobber_package
57
+
58
+ desc "Update the gemspec for GitHub's gem server"
59
+ task :gemspec do
60
+ Pathname("#{spec.name}.gemspec").open('w') {|f| f << YAML.dump(spec) }
61
+ end
62
+
63
+ desc "Install gem"
64
+ task :install => [:clobber, :package] do
65
+ sh "#{SUDO} #{gem} install pkg/#{spec.full_name}.gem"
66
+ end
67
+
68
+ desc "Uninstall gem"
69
+ task :uninstall => :clean do
70
+ sh "#{SUDO} #{gem} uninstall -v #{spec.version} -x #{spec.name}"
71
+ end
@@ -0,0 +1,21 @@
1
+ require 'minitest/unit'
2
+ require 'override'
3
+
4
+ class MiniTest::Unit::TestCase
5
+ override :run
6
+ def run(runner)
7
+ result = super
8
+ RedGreen.colour = :red unless self.passed?
9
+ result
10
+ end
11
+ end
12
+
13
+ class MiniTest::Unit
14
+ override :run
15
+ def run(args = [])
16
+ count = super
17
+ @@out.puts RedGreen.visual
18
+ @@out.puts
19
+ count
20
+ end
21
+ end
@@ -0,0 +1,20 @@
1
+ require 'test/unit/testresult'
2
+ require 'test/unit/ui/console/testrunner'
3
+ require 'test/unit/ui/testrunnermediator'
4
+ require 'override'
5
+
6
+ class Test::Unit::UI::Console::TestRunner
7
+
8
+ override :attach_to_mediator
9
+ def attach_to_mediator
10
+ super
11
+ @mediator.add_listener(Test::Unit::TestResult::FAULT) { RedGreen.colour = :red }
12
+ end
13
+
14
+ override :finished
15
+ def finished(elapsed_time)
16
+ super
17
+ output(RedGreen.visual)
18
+ nl
19
+ end
20
+ end
data/lib/redgreen.rb ADDED
@@ -0,0 +1,18 @@
1
+ #:stopdoc:
2
+ require 'pathname'
3
+ require 'term/ansicolor'
4
+
5
+ module RedGreen
6
+ extend self
7
+
8
+ attr_accessor :colour
9
+
10
+ def visual
11
+ Term::ANSIColor.send(self.colour || :green) { "="*78 }
12
+ end
13
+ end
14
+
15
+ dir = Pathname(__FILE__).dirname.parent.join('lib/redgreen')
16
+
17
+ require dir.join('testunit') if defined?(Test::Unit::TestCase)
18
+ require dir.join('minitest') if defined?(MiniTest::Unit::TestCase)
data/redgreen.gemspec ADDED
@@ -0,0 +1,90 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: redgreen
3
+ version: !ruby/object:Gem::Version
4
+ version: "0.5"
5
+ platform: ruby
6
+ authors:
7
+ - Martin Aumont
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-08-19 00:00:00 -04:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: mynyml-override
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0.5"
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: term-ansicolor
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 1.0.4
34
+ version:
35
+ description: Standalone redgreen eye candy for test results, ala autotest
36
+ email: mynyml@gmail.com
37
+ executables: []
38
+
39
+ extensions: []
40
+
41
+ extra_rdoc_files: []
42
+
43
+ files:
44
+ - Rakefile
45
+ - test
46
+ - test/testunit
47
+ - test/testunit/test_failure.rb
48
+ - test/testunit/test_success.rb
49
+ - test/tests.rake
50
+ - test/minitest
51
+ - test/minitest/test_failure.rb
52
+ - test/minitest/test_success.rb
53
+ - lib
54
+ - lib/redgreen
55
+ - lib/redgreen/testunit.rb
56
+ - lib/redgreen/minitest.rb
57
+ - lib/redgreen.rb
58
+ - redgreen.gemspec
59
+ - LICENSE
60
+ - README
61
+ has_rdoc: true
62
+ homepage: ""
63
+ licenses: []
64
+
65
+ post_install_message:
66
+ rdoc_options: []
67
+
68
+ require_paths:
69
+ - lib
70
+ required_ruby_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: "0"
75
+ version:
76
+ required_rubygems_version: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: "0"
81
+ version:
82
+ requirements: []
83
+
84
+ rubyforge_project:
85
+ rubygems_version: 1.3.5
86
+ signing_key:
87
+ specification_version: 3
88
+ summary: Standalone redgreen eye candy for test results, ala autotest
89
+ test_files: []
90
+
@@ -0,0 +1,10 @@
1
+ require 'pathname'
2
+ require 'minitest/autorun'
3
+ root = Pathname(__FILE__).dirname.parent.parent
4
+ require root + 'lib/redgreen'
5
+
6
+ class TestTestUnitFailure < MiniTest::Unit::TestCase
7
+ def test_failure
8
+ flunk
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ require 'pathname'
2
+ require 'minitest/autorun'
3
+ root = Pathname(__FILE__).dirname.parent.parent
4
+ require root + 'lib/redgreen'
5
+
6
+ class TestTestUnitSuccess < MiniTest::Unit::TestCase
7
+ def test_success
8
+ assert true
9
+ end
10
+ end
data/test/tests.rake ADDED
@@ -0,0 +1,14 @@
1
+ require 'pathname'
2
+
3
+ task(:test_all) do
4
+ test_root = Pathname(__FILE__).dirname
5
+
6
+ files = %w(
7
+ testunit/test_success.rb
8
+ testunit/test_failure.rb
9
+ minitest/test_success.rb
10
+ minitest/test_failure.rb
11
+ )
12
+ files.map! {|file| Pathname(file).expand_path(test_root) }
13
+ files.each {|file| system("ruby -rubygems #{file}") }
14
+ end
@@ -0,0 +1,10 @@
1
+ require 'pathname'
2
+ require 'test/unit'
3
+ root = Pathname(__FILE__).dirname.parent.parent
4
+ require root + 'lib/redgreen'
5
+
6
+ class TestTestUnitFailure < Test::Unit::TestCase
7
+ def test_failure
8
+ flunk
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ require 'pathname'
2
+ require 'test/unit'
3
+ root = Pathname(__FILE__).dirname.parent.parent
4
+ require root + 'lib/redgreen'
5
+
6
+ class TestTestUnitSuccess < Test::Unit::TestCase
7
+ def test_success
8
+ assert true
9
+ end
10
+ end
metadata ADDED
@@ -0,0 +1,90 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mynyml-redgreen
3
+ version: !ruby/object:Gem::Version
4
+ version: "0.5"
5
+ platform: ruby
6
+ authors:
7
+ - Martin Aumont
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-08-18 21:00:00 -07:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: mynyml-override
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0.5"
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: term-ansicolor
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 1.0.4
34
+ version:
35
+ description: Standalone redgreen eye candy for test results, ala autotest
36
+ email: mynyml@gmail.com
37
+ executables: []
38
+
39
+ extensions: []
40
+
41
+ extra_rdoc_files: []
42
+
43
+ files:
44
+ - Rakefile
45
+ - test
46
+ - test/testunit
47
+ - test/testunit/test_failure.rb
48
+ - test/testunit/test_success.rb
49
+ - test/tests.rake
50
+ - test/minitest
51
+ - test/minitest/test_failure.rb
52
+ - test/minitest/test_success.rb
53
+ - lib
54
+ - lib/redgreen
55
+ - lib/redgreen/testunit.rb
56
+ - lib/redgreen/minitest.rb
57
+ - lib/redgreen.rb
58
+ - redgreen.gemspec
59
+ - LICENSE
60
+ - README
61
+ has_rdoc: true
62
+ homepage: ""
63
+ licenses: []
64
+
65
+ post_install_message:
66
+ rdoc_options: []
67
+
68
+ require_paths:
69
+ - lib
70
+ required_ruby_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: "0"
75
+ version:
76
+ required_rubygems_version: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: "0"
81
+ version:
82
+ requirements: []
83
+
84
+ rubyforge_project:
85
+ rubygems_version: 1.3.5
86
+ signing_key:
87
+ specification_version: 3
88
+ summary: Standalone redgreen eye candy for test results, ala autotest
89
+ test_files: []
90
+