minitest-untz 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d4d535b4b0512dcbbb1b6ad09ab84451e39a9be4
4
+ data.tar.gz: 3811bbb46961c67d810f48f9056291824b885822
5
+ SHA512:
6
+ metadata.gz: 8aefa4c20ae1a1d57030c5b7065536e340f4fbff0b8b33c5b2fad9d2b74c28f8f517fd99e7fb88afd86966c80ddc8c45420072f96320903c947da0e31db5c56b
7
+ data.tar.gz: 10da4eb3197a0379504939fb232de808e047eb27e12487e5bc78d1b2054f15e7c29d31aeab02a73659a3870a82df07dcbe2855e9a66d5a6f73723631e4dff219
data/.gitignore ADDED
@@ -0,0 +1,22 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in minitest-untz.gemspec
4
+ gemspec
data/Guardfile ADDED
@@ -0,0 +1,5 @@
1
+ guard :minitest do
2
+ watch(%r{^spec/(.*)_spec\.rb$})
3
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
4
+ watch(%r{^spec/spec_helper\.rb$}) { 'spec' }
5
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Ernie Miller
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,32 @@
1
+ # Minitest::Untz
2
+
3
+ Like a rave every time you test.
4
+
5
+ ![](https://raw.githubusercontent.com/louisvillerb/minitest-untz/master/images/untz.png)
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ gem 'minitest-untz'
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install minitest-untz
20
+
21
+ ## Usage
22
+
23
+ Enable untz output format with `-u` or `--untz` test options, or just require
24
+ `minitest/untz`.
25
+
26
+ ## Contributing
27
+
28
+ 1. Fork it ( https://github.com/[my-github-username]/minitest-untz/fork )
29
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
30
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
31
+ 4. Push to the branch (`git push origin my-new-feature`)
32
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new do |t|
5
+ t.libs << 'spec'
6
+ t.pattern = 'spec/**/*_spec.rb'
7
+ t.verbose = true
8
+ end
9
+
10
+ task :default => :test
data/images/untz.png ADDED
Binary file
@@ -0,0 +1,4 @@
1
+ require "minitest"
2
+
3
+ Minitest.load_plugins
4
+ Minitest::UntzIO.untz!
@@ -0,0 +1,5 @@
1
+ module Minitest
2
+ module Untz
3
+ VERSION = "0.5.0"
4
+ end
5
+ end
@@ -0,0 +1,119 @@
1
+ require 'minitest'
2
+
3
+ module Minitest
4
+ def self.plugin_untz_options(opts, options) # :nodoc:
5
+ opts.on "-u", "--untz", "Run your tests with a beat you can dance to." do
6
+ UntzIO.untz!
7
+ end
8
+ end
9
+
10
+ def self.plugin_untz_init(options) # :nodoc:
11
+ if UntzIO.untz?
12
+ klass = ENV['TERM'] =~ /^xterm|-256color$/ ? UntzLOL : UntzIO
13
+ io = klass.new options[:io]
14
+
15
+ self.reporter.reporters.grep(Minitest::Reporter).each do |rep|
16
+ rep.io = io
17
+ end
18
+ end
19
+ end
20
+
21
+ class UntzIO
22
+
23
+ def self.untz!
24
+ @untz = true
25
+ end
26
+
27
+ def self.untz?
28
+ @untz ||= false
29
+ end
30
+
31
+ # Start an escape sequence
32
+ ESC = "\e["
33
+
34
+ # End the escape sequence
35
+ NND = "#{ESC}0m"
36
+
37
+ attr_reader :io
38
+
39
+ def initialize(io) # :nodoc:
40
+ @io = io
41
+ # stolen from minitest/pride, which in turn was
42
+ # stolen from /System/Library/Perl/5.10.0/Term/ANSIColor.pm
43
+ # also reference http://en.wikipedia.org/wiki/ANSI_escape_code
44
+ @colors ||= (31..36).to_a
45
+ @size = @colors.size
46
+ @index = 0
47
+ end
48
+
49
+ def print(o)
50
+ case o
51
+ when '.', 'S'
52
+ io.print "#{untz(o)} "
53
+ when 'E'
54
+ io.print "#{ESC}41m#{ESC}37m#{o}#{NND} "
55
+ when 'F'
56
+ io.print "#{ESC}41m#{ESC}37mSKREE#{NND} "
57
+ else
58
+ io.print "#{o} "
59
+ end
60
+ end
61
+
62
+ def puts(*o) # :nodoc:
63
+ o.map! { |s|
64
+ s.to_s.sub(/Finished/) {
65
+ @index = 0
66
+ 'Ravin\' run'.split(//).map { |c|
67
+ untz(c)
68
+ }.join
69
+ }
70
+ }
71
+
72
+ io.puts(*o)
73
+ end
74
+
75
+ def untz(string)
76
+ string = case string
77
+ when '.' then 'untz'
78
+ when 'S' then 'wub'
79
+ else string
80
+ end
81
+ c = @colors[@index % @size]
82
+ @index += 1
83
+ "#{ESC}#{c}m#{string}#{NND}"
84
+ end
85
+
86
+ def method_missing(msg, *args) # :nodoc:
87
+ io.send(msg, *args)
88
+ end
89
+ end
90
+
91
+ class UntzLOL < UntzIO
92
+ PI_3 = Math::PI / 3 # :nodoc:
93
+
94
+ def initialize(io) # :nodoc:
95
+ @colors = (0...(6 * 7)).map { |n|
96
+ n *= 1.0 / 6
97
+ r = (3 * Math.sin(n ) + 3).to_i
98
+ g = (3 * Math.sin(n + 2 * PI_3) + 3).to_i
99
+ b = (3 * Math.sin(n + 4 * PI_3) + 3).to_i
100
+
101
+ 36 * r + 6 * g + b + 16
102
+ }
103
+
104
+ super
105
+ end
106
+
107
+ def untz(string)
108
+ string = case string
109
+ when '.' then 'untz'
110
+ when 'S' then 'wub'
111
+ else string
112
+ end
113
+ c = @colors[@index % @size]
114
+ @index += 1
115
+ "#{ESC}38;5;#{c}m#{string}#{NND}"
116
+ end
117
+ end
118
+
119
+ end
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'minitest/untz/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'minitest-untz'
8
+ spec.version = Minitest::Untz::VERSION
9
+ spec.authors = ['Ernie Miller']
10
+ spec.email = ['ernie@erniemiller.org']
11
+ spec.summary = %q{Like a rave every time you test.}
12
+ spec.description = %q{Colorizes test output and replaces output strings with sweet onomatopoeia.}
13
+ spec.homepage = ''
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_dependency 'minitest'
22
+ spec.add_development_dependency 'bundler', '~> 1.6'
23
+ spec.add_development_dependency 'rake'
24
+ spec.add_development_dependency 'guard-minitest'
25
+ spec.add_development_dependency 'terminal-notifier-guard'
26
+ end
@@ -0,0 +1,33 @@
1
+ require 'spec_helper'
2
+
3
+ module Minitest
4
+ describe UntzIO do
5
+
6
+ 100.times do
7
+ it 'does some passing stuff' do
8
+ true.must_equal true
9
+ end
10
+ end
11
+
12
+ 10.times do
13
+ it 'does some skipping stuff' do
14
+ skip
15
+ end
16
+ end
17
+
18
+ if ENV['UNTZ_FAIL']
19
+ 10.times do
20
+ it 'does some failing stuff' do
21
+ false.must_equal true
22
+ end
23
+ end
24
+
25
+ 10.times do
26
+ it 'does some erroring stuff' do
27
+ raise
28
+ end
29
+ end
30
+ end
31
+
32
+ end
33
+ end
@@ -0,0 +1,2 @@
1
+ require 'minitest/autorun'
2
+ require 'minitest/untz'
metadata ADDED
@@ -0,0 +1,129 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: minitest-untz
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.0
5
+ platform: ruby
6
+ authors:
7
+ - Ernie Miller
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-05-23 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.6'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.6'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: guard-minitest
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: terminal-notifier-guard
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: Colorizes test output and replaces output strings with sweet onomatopoeia.
84
+ email:
85
+ - ernie@erniemiller.org
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".gitignore"
91
+ - Gemfile
92
+ - Guardfile
93
+ - LICENSE.txt
94
+ - README.md
95
+ - Rakefile
96
+ - images/untz.png
97
+ - lib/minitest/untz.rb
98
+ - lib/minitest/untz/version.rb
99
+ - lib/minitest/untz_plugin.rb
100
+ - minitest-untz.gemspec
101
+ - spec/minitest/untz_plugin_spec.rb
102
+ - spec/spec_helper.rb
103
+ homepage: ''
104
+ licenses:
105
+ - MIT
106
+ metadata: {}
107
+ post_install_message:
108
+ rdoc_options: []
109
+ require_paths:
110
+ - lib
111
+ required_ruby_version: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
116
+ required_rubygems_version: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
121
+ requirements: []
122
+ rubyforge_project:
123
+ rubygems_version: 2.2.2
124
+ signing_key:
125
+ specification_version: 4
126
+ summary: Like a rave every time you test.
127
+ test_files:
128
+ - spec/minitest/untz_plugin_spec.rb
129
+ - spec/spec_helper.rb