nyan-cat-formatter 0.7.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +3 -1
- data/gemfiles/rspec2 +3 -1
- data/gemfiles/rspec2.lock +10 -9
- data/lib/nyan_cat_format/helpers.rb +7 -0
- data/lib/nyan_cat_format/music.rb +3 -3
- data/lib/nyan_cat_formatter/common.rb +57 -11
- data/lib/nyan_cat_formatter/rspec3.rb +3 -16
- data/lib/nyan_cat_music_formatter.rb +5 -0
- data/lib/nyan_cat_verbose_formatter.rb +5 -0
- data/lib/nyan_cat_wide_formatter.rb +3 -3
- data/lib/nyan_cat_wide_music_formatter.rb +5 -0
- data/nyan-cat-formatter.gemspec +2 -2
- data/spec/nyan_cat_music_formatter_spec.rb +2 -6
- metadata +5 -4
data/.travis.yml
CHANGED
data/gemfiles/rspec2
CHANGED
data/gemfiles/rspec2.lock
CHANGED
@@ -1,19 +1,20 @@
|
|
1
1
|
GEM
|
2
|
+
remote: https://rubygems.org/
|
2
3
|
specs:
|
3
4
|
diff-lcs (1.2.5)
|
4
|
-
rake (10.
|
5
|
-
rspec (2.
|
6
|
-
rspec-core (~> 2.
|
7
|
-
rspec-expectations (~> 2.
|
8
|
-
rspec-mocks (~> 2.
|
9
|
-
rspec-core (2.
|
10
|
-
rspec-expectations (2.
|
5
|
+
rake (10.3.2)
|
6
|
+
rspec (2.99.0)
|
7
|
+
rspec-core (~> 2.99.0)
|
8
|
+
rspec-expectations (~> 2.99.0)
|
9
|
+
rspec-mocks (~> 2.99.0)
|
10
|
+
rspec-core (2.99.0)
|
11
|
+
rspec-expectations (2.99.0)
|
11
12
|
diff-lcs (>= 1.1.3, < 2.0)
|
12
|
-
rspec-mocks (2.
|
13
|
+
rspec-mocks (2.99.0)
|
13
14
|
|
14
15
|
PLATFORMS
|
15
16
|
ruby
|
16
17
|
|
17
18
|
DEPENDENCIES
|
18
19
|
rake
|
19
|
-
rspec (~> 2.
|
20
|
+
rspec (~> 2.99)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module NyanCatFormat
|
2
2
|
module Music
|
3
|
-
|
3
|
+
|
4
4
|
MUSIC_LENGTH = 27.06 # seconds
|
5
5
|
|
6
6
|
def osx?
|
@@ -59,11 +59,11 @@ module NyanCatFormat
|
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
|
-
def dump_summary(
|
62
|
+
def dump_summary(*args)
|
63
63
|
kill_music
|
64
64
|
super
|
65
65
|
end
|
66
|
-
|
66
|
+
|
67
67
|
private
|
68
68
|
|
69
69
|
def play_on_linux
|
@@ -9,10 +9,25 @@ module NyanCat
|
|
9
9
|
ERROR = '!'
|
10
10
|
PENDING = '+'
|
11
11
|
|
12
|
+
VT100_CODES =
|
13
|
+
{
|
14
|
+
:black => 30,
|
15
|
+
:red => 31,
|
16
|
+
:green => 32,
|
17
|
+
:yellow => 33,
|
18
|
+
:blue => 34,
|
19
|
+
:magenta => 35,
|
20
|
+
:cyan => 36,
|
21
|
+
:white => 37,
|
22
|
+
:bold => 1,
|
23
|
+
}
|
24
|
+
|
25
|
+
VT100_CODE_VALUES = VT100_CODES.invert
|
26
|
+
|
12
27
|
def self.included(base)
|
13
28
|
base.class_eval do
|
14
29
|
attr_reader :current, :example_results, :color_index, :pending_count, :failure_count,
|
15
|
-
|
30
|
+
:example_count
|
16
31
|
end
|
17
32
|
end
|
18
33
|
|
@@ -48,7 +63,7 @@ module NyanCat
|
|
48
63
|
def dump_progress
|
49
64
|
output.print(progress_lines.join("\n") + eol)
|
50
65
|
end
|
51
|
-
|
66
|
+
|
52
67
|
def progress_lines
|
53
68
|
padding = @example_count.to_s.length * 2 + 2
|
54
69
|
[
|
@@ -131,15 +146,15 @@ module NyanCat
|
|
131
146
|
# @return [Array] Nyan cats
|
132
147
|
def ascii_cat(o = '^')
|
133
148
|
[[ "_,------, ",
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
149
|
+
"_| /\\_/\\ ",
|
150
|
+
"~|_( #{o} .#{o}) ",
|
151
|
+
" \"\" \"\" "
|
152
|
+
],
|
153
|
+
[ "_,------, ",
|
154
|
+
"_| /\\_/\\",
|
155
|
+
"^|__( #{o} .#{o}) ",
|
156
|
+
" \" \" \" \""
|
157
|
+
]]
|
143
158
|
end
|
144
159
|
|
145
160
|
# Colorizes the string with raindow colors of the rainbow
|
@@ -214,5 +229,36 @@ module NyanCat
|
|
214
229
|
def cat_length
|
215
230
|
nyan_cat.split("\n").group_by(&:size).max.first
|
216
231
|
end
|
232
|
+
|
233
|
+
def success_color(text)
|
234
|
+
wrap(text, :success)
|
235
|
+
end
|
236
|
+
|
237
|
+
def pending_color(text)
|
238
|
+
wrap(text, :pending)
|
239
|
+
end
|
240
|
+
|
241
|
+
def failure_color(text)
|
242
|
+
wrap(text, :failure)
|
243
|
+
end
|
244
|
+
|
245
|
+
def console_code_for(code_or_symbol)
|
246
|
+
if VT100_CODE_VALUES.has_key?(code_or_symbol)
|
247
|
+
code_or_symbol
|
248
|
+
else
|
249
|
+
VT100_CODES.fetch(code_or_symbol) do
|
250
|
+
console_code_for(:white)
|
251
|
+
end
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
255
|
+
def wrap(text, code_or_symbol)
|
256
|
+
if RSpec.configuration.color_enabled?
|
257
|
+
"\e[#{console_code_for(code_or_symbol)}m#{text}\e[0m"
|
258
|
+
else
|
259
|
+
text
|
260
|
+
end
|
261
|
+
end
|
262
|
+
|
217
263
|
end
|
218
264
|
end
|
@@ -11,6 +11,8 @@ class RSpec3 < RSpec::Core::Formatters::BaseTextFormatter
|
|
11
11
|
|
12
12
|
def initialize(output)
|
13
13
|
super(output)
|
14
|
+
@failure_count = 0
|
15
|
+
@pending_count = 0
|
14
16
|
end
|
15
17
|
|
16
18
|
def start(notification)
|
@@ -37,25 +39,11 @@ class RSpec3 < RSpec::Core::Formatters::BaseTextFormatter
|
|
37
39
|
end
|
38
40
|
|
39
41
|
def example_pending(notification)
|
40
|
-
if notification.respond_to?(:example)
|
41
|
-
super(notification)
|
42
|
-
else
|
43
|
-
super(OpenStruct.new(:example => notification))
|
44
|
-
end
|
45
|
-
|
46
42
|
@pending_count += 1
|
47
|
-
|
48
43
|
tick PENDING
|
49
44
|
end
|
50
45
|
|
51
46
|
def example_failed(notification)
|
52
|
-
# TODO: Lazy fix for specs
|
53
|
-
if notification.respond_to?(:example)
|
54
|
-
super(notification)
|
55
|
-
else
|
56
|
-
super(OpenStruct.new(:example => notification))
|
57
|
-
end
|
58
|
-
|
59
47
|
@failure_count += 1
|
60
48
|
tick FAIL
|
61
49
|
end
|
@@ -67,10 +55,9 @@ class RSpec3 < RSpec::Core::Formatters::BaseTextFormatter
|
|
67
55
|
def dump_summary(notification)
|
68
56
|
duration = notification.duration
|
69
57
|
failure_count = notification.failure_count
|
70
|
-
dump_profile if profile_examples? && failure_count == 0
|
71
58
|
summary = "\nYou've Nyaned for #{format_duration(duration)}\n".split(//).map { |c| rainbowify(c) }
|
72
59
|
output.puts summary.join
|
73
|
-
output.puts
|
60
|
+
output.puts notification.fully_formatted
|
74
61
|
if respond_to?(:dump_commands_to_rerun_failed_examples)
|
75
62
|
dump_commands_to_rerun_failed_examples
|
76
63
|
end
|
@@ -1,7 +1,12 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
require 'nyan_cat_formatter'
|
3
3
|
require 'nyan_cat_format/music'
|
4
|
+
require 'nyan_cat_format/helpers'
|
4
5
|
|
5
6
|
NyanCatMusicFormatter = Class.new(NyanCatFormatter) do
|
7
|
+
extend NyanCatFormat::Helpers
|
6
8
|
include NyanCatFormat::Music
|
9
|
+
|
10
|
+
RSpec::Core::Formatters.register(self, :example_passed, :example_pending,
|
11
|
+
:example_failed, :start_dump, :start) if rspec_3_or_greater?
|
7
12
|
end
|
@@ -1,7 +1,12 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
require 'nyan_cat_formatter'
|
3
3
|
require 'nyan_cat_format/verbose'
|
4
|
+
require 'nyan_cat_format/helpers'
|
4
5
|
|
5
6
|
NyanCatVerboseFormatter = Class.new(NyanCatFormatter) do
|
7
|
+
extend NyanCatFormat::Helpers
|
6
8
|
include NyanCatFormat::Verbose
|
9
|
+
|
10
|
+
RSpec::Core::Formatters.register(self, :example_passed, :example_pending,
|
11
|
+
:example_failed, :start_dump, :start) if rspec_3_or_greater?
|
7
12
|
end
|
@@ -1,12 +1,12 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
require 'nyan_cat_formatter'
|
3
3
|
require 'nyan_cat_format/wide'
|
4
|
+
require 'nyan_cat_format/helpers'
|
4
5
|
|
5
6
|
NyanCatWideFormatter = Class.new(NyanCatFormatter) do
|
7
|
+
extend NyanCatFormat::Helpers
|
6
8
|
include NyanCatFormat::Wide
|
7
9
|
|
8
|
-
rspec_3_or_greater = Gem::Version.new(RSpec::Core::Version::STRING).release >= Gem::Version.new('3.0.0')
|
9
|
-
|
10
10
|
RSpec::Core::Formatters.register(self, :example_passed, :example_pending,
|
11
|
-
:example_failed, :start_dump, :start) if rspec_3_or_greater
|
11
|
+
:example_failed, :start_dump, :start) if rspec_3_or_greater?
|
12
12
|
end
|
@@ -1,9 +1,14 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
require 'nyan_cat_formatter'
|
3
|
+
require 'nyan_cat_format/helpers'
|
3
4
|
require 'nyan_cat_format/wide'
|
4
5
|
require 'nyan_cat_format/music'
|
5
6
|
|
6
7
|
NyanCatWideMusicFormatter = Class.new(NyanCatFormatter) do
|
8
|
+
extend NyanCatFormat::Helpers
|
7
9
|
include NyanCatFormat::Wide
|
8
10
|
include NyanCatFormat::Music
|
11
|
+
|
12
|
+
RSpec::Core::Formatters.register(self, :example_passed, :example_pending,
|
13
|
+
:example_failed, :start_dump, :start) if rspec_3_or_greater?
|
9
14
|
end
|
data/nyan-cat-formatter.gemspec
CHANGED
@@ -2,7 +2,7 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "nyan-cat-formatter"
|
5
|
-
s.version = "0.
|
5
|
+
s.version = "0.8.0"
|
6
6
|
s.authors = ["Matt Sears"]
|
7
7
|
s.email = ["matt@mattsears.com"]
|
8
8
|
s.homepage = "https://github.com/mattsears/nyan-cat-formatter"
|
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
17
17
|
s.require_paths = ["lib"]
|
18
18
|
|
19
|
-
s.add_dependency "rspec", ">= 2.14.2", ">= 2.99
|
19
|
+
s.add_dependency "rspec", ">= 2.14.2", ">= 2.99", "< 4"
|
20
20
|
|
21
21
|
s.add_development_dependency "rake"
|
22
22
|
end
|
@@ -68,12 +68,8 @@ describe NyanCatMusicFormatter do
|
|
68
68
|
before { formatter.platform = 'linux'}
|
69
69
|
it 'plays the song for linux too' do
|
70
70
|
formatter.start 10
|
71
|
-
expect {
|
72
|
-
|
73
|
-
}.to be
|
74
|
-
expect {
|
75
|
-
mock_kernel.seen.any? { |entry| entry. end_with? "mpg123 #{path_to_mp3} &>/dev/null &" }
|
76
|
-
}.to be
|
71
|
+
expect(mock_kernel.seen.any? { |entry| entry. end_with? "mpg321 #{path_to_mp3} &>/dev/null &" }).to be
|
72
|
+
expect(mock_kernel.seen.any? { |entry| entry. end_with? "mpg123 #{path_to_mp3} &>/dev/null &" }).to be
|
77
73
|
end
|
78
74
|
end
|
79
75
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nyan-cat-formatter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-06-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: 2.14.2
|
22
22
|
- - ! '>='
|
23
23
|
- !ruby/object:Gem::Version
|
24
|
-
version: 2.99
|
24
|
+
version: '2.99'
|
25
25
|
- - <
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '4'
|
@@ -35,7 +35,7 @@ dependencies:
|
|
35
35
|
version: 2.14.2
|
36
36
|
- - ! '>='
|
37
37
|
- !ruby/object:Gem::Version
|
38
|
-
version: 2.99
|
38
|
+
version: '2.99'
|
39
39
|
- - <
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '4'
|
@@ -77,6 +77,7 @@ files:
|
|
77
77
|
- gemfiles/rspec1.lock
|
78
78
|
- gemfiles/rspec2
|
79
79
|
- gemfiles/rspec2.lock
|
80
|
+
- lib/nyan_cat_format/helpers.rb
|
80
81
|
- lib/nyan_cat_format/music.rb
|
81
82
|
- lib/nyan_cat_format/verbose.rb
|
82
83
|
- lib/nyan_cat_format/wide.rb
|