minitest-red_green 0.9.0

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 90db92c701ea6b15b2e5d95660fc3eb949e01389
4
+ data.tar.gz: 6ad5902662868bba4aecc031f61b46926b2b88b0
5
+ SHA512:
6
+ metadata.gz: dd03d91bde972ea74be4d546f7d81a36c346343298ac71861fb7e191ee925f617a1ceba1b39cd9feb61322885fd1f6b3074a1a6647051632f912fc9e38caf2df
7
+ data.tar.gz: cb61125e4e289937f473d1bfa2bec28a4a978c7481ad388ddcfadddbb4b6c636c4820275fb03c0e93f0f2b59f3b56e0290528ae56902890e96aaa53786bafb33
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in minitest-red_green.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 ntl
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # Minitest::RedGreen
2
+
3
+ Adds red/green colors to standard minitest output
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'minitest-red_green'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install minitest-red_green
20
+
21
+ ## Usage
22
+
23
+ Once you add this gem to your `Gemfile`, minitest should start printing out red and green colors. If you wish to disable this for some reason,
24
+
25
+ ```ruby
26
+ Minitest::RedGreenPlugin.disabled = true
27
+ ```
28
+
29
+ Although, it's probably much simpler to simply remove this gem from your `Gemfile` in the first place :)
30
+
31
+ ## Why not minitest-reporters
32
+
33
+ There is another gem, [minitest-reporters](https://github.com/kern/minitest-reporters/), that also adds red/green progress output. However, often this is overkill for gems or small applications.
34
+
35
+ ## Contributing
36
+
37
+ 1. Fork it ( https://github.com/[my-github-username]/minitest-red_green/fork )
38
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
39
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
40
+ 4. Push to the branch (`git push origin my-new-feature`)
41
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
data/bin/rake ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'rake' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ exec 'bin/test_runner' if ARGV.empty?
10
+
11
+ require 'pathname'
12
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ require 'rubygems'
16
+ require 'bundler/setup'
17
+
18
+ load Gem.bin_path('rake', 'rake')
data/bin/test_runner ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler'
4
+ Bundler.setup
5
+ Bundler.require :default, :development
6
+
7
+ require 'minitest'
8
+
9
+ load 'test/red_green_test.rb'
10
+
11
+ Minitest::RedGreenPlugin.disabled = ENV['TEST_DISABLE']
12
+
13
+ passed = Minitest.run
14
+ exit passed ? 0 : 1
@@ -0,0 +1,5 @@
1
+ module Minitest
2
+ module RedGreen
3
+ VERSION = "0.9.0"
4
+ end
5
+ end
@@ -0,0 +1,2 @@
1
+ require_relative 'red_green/version'
2
+ require_relative 'red_green_plugin'
@@ -0,0 +1,57 @@
1
+ module Minitest
2
+ def self.plugin_red_green_init options
3
+ return if RedGreenPlugin.disabled
4
+ reporters = self.reporter.reporters.grep Minitest::Reporter
5
+ reporters.each do |reporter|
6
+ reporter.io = RedGreenPlugin.new options[:io]
7
+ end
8
+ end
9
+
10
+ class RedGreenPlugin
11
+ singleton_class.send :attr_accessor, :disabled
12
+
13
+ attr_accessor :sync
14
+
15
+ ESC = "\e["
16
+
17
+ def initialize io
18
+ @io = io
19
+ end
20
+
21
+ def puts *strings
22
+ if not strings.grep(%r{\d+\) (?:Failure|Error)}).empty?
23
+ strings.map! &method(:red)
24
+ end
25
+ @io.puts *strings
26
+ end
27
+
28
+ def print str
29
+ @io.print filter_test_output_chars str
30
+ end
31
+
32
+ def filter_test_output_chars str
33
+ case str
34
+ when '.' then green str
35
+ when 'E', 'F' then red str
36
+ when 'S' then yellow str
37
+ else str
38
+ end
39
+ end
40
+
41
+ def green str
42
+ colorize str, 32
43
+ end
44
+
45
+ def red str
46
+ colorize str, 31
47
+ end
48
+
49
+ def yellow str
50
+ colorize str, 33
51
+ end
52
+
53
+ def colorize str, col_code
54
+ "#{ESC}#{col_code}m#{str}#{ESC}0m"
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'minitest/red_green/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "minitest-red_green"
8
+ spec.version = Minitest::RedGreen::VERSION
9
+ spec.authors = ["ntl"]
10
+ spec.email = ["nathanladd+github@gmail.com"]
11
+ spec.summary = %q{Adds red/green colors to standard minitest output}
12
+ spec.description = %q{Adds red/green colors to standard minitest output}
13
+ spec.homepage = "https://github.com/ntl/minitest-red_green"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = []
18
+ spec.test_files = spec.files.grep %r{test}
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "minitest"
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.7"
24
+ spec.add_development_dependency "rake", "~> 10.0"
25
+ end
@@ -0,0 +1,17 @@
1
+ class RedGreenTest < Minitest::Test
2
+ def test_truth
3
+ assert true
4
+ end
5
+
6
+ def test_false
7
+ refute true
8
+ end
9
+
10
+ def test_skip
11
+ skip
12
+ end
13
+
14
+ def test_error
15
+ raise 'hell'
16
+ end
17
+ end
metadata ADDED
@@ -0,0 +1,104 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: minitest-red_green
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.9.0
5
+ platform: ruby
6
+ authors:
7
+ - ntl
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-09-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: minitest
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.7'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.7'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ description: Adds red/green colors to standard minitest output
56
+ email:
57
+ - nathanladd+github@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - Gemfile
64
+ - LICENSE.txt
65
+ - README.md
66
+ - Rakefile
67
+ - bin/rake
68
+ - bin/test_runner
69
+ - lib/minitest/red_green.rb
70
+ - lib/minitest/red_green/version.rb
71
+ - lib/minitest/red_green_plugin.rb
72
+ - minitest-red_green.gemspec
73
+ - test/red_green_test.rb
74
+ homepage: https://github.com/ntl/minitest-red_green
75
+ licenses:
76
+ - MIT
77
+ metadata: {}
78
+ post_install_message:
79
+ rdoc_options: []
80
+ require_paths:
81
+ - lib
82
+ required_ruby_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ required_rubygems_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ requirements: []
93
+ rubyforge_project:
94
+ rubygems_version: 2.4.1
95
+ signing_key:
96
+ specification_version: 4
97
+ summary: Adds red/green colors to standard minitest output
98
+ test_files:
99
+ - bin/test_runner
100
+ - lib/minitest/red_green.rb
101
+ - lib/minitest/red_green/version.rb
102
+ - lib/minitest/red_green_plugin.rb
103
+ - minitest-red_green.gemspec
104
+ - test/red_green_test.rb