nyan-cat-formatter 0.3.0 → 0.4.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.
- data/README.md +2 -8
- data/data/nyan-cat.mp3 +0 -0
- data/lib/nyan_cat_music_formatter.rb +23 -6
- data/nyan-cat-formatter.gemspec +1 -1
- data/nyan_example.gif +0 -0
- metadata +3 -2
data/README.md
CHANGED
@@ -1,12 +1,7 @@
|
|
1
1
|
Nyan Cat RSpec Formatter [](http://travis-ci.org/mattsears/nyan-cat-formatter)
|
2
2
|
========
|
3
3
|
|
4
|
-
|
5
|
-
-_-_-_-_-_-_-_,------,
|
6
|
-
_-_-_-_-_-_-_-| /\_/\
|
7
|
-
-_-_-_-_-_-_-~|__( ^ .^)
|
8
|
-
_-_-_-_-_-_-_-"" ""
|
9
|
-
```
|
4
|
+

|
10
5
|
|
11
6
|
This is my take on the Nyan Cat RSpec Formatter. It simply creates a rainbow trail of test results. It also counts the number of examples as they execute and highlights failed and pending specs.
|
12
7
|
|
@@ -102,5 +97,4 @@ Once you've made your great commits:
|
|
102
97
|
|
103
98
|
Author
|
104
99
|
----------
|
105
|
-
[Matt Sears](
|
106
|
-
|
100
|
+
[Matt Sears](http://www.mattsears.com) :: @mattsears
|
data/data/nyan-cat.mp3
CHANGED
Binary file
|
@@ -2,6 +2,8 @@
|
|
2
2
|
require 'nyan_cat_formatter'
|
3
3
|
|
4
4
|
NyanCatMusicFormatter = Class.new(NyanCatFormatter) do
|
5
|
+
MUSIC_LENGTH = 27.06 # seconds
|
6
|
+
|
5
7
|
def osx?
|
6
8
|
platform.downcase.include?("darwin")
|
7
9
|
end
|
@@ -32,25 +34,40 @@ NyanCatMusicFormatter = Class.new(NyanCatFormatter) do
|
|
32
34
|
|
33
35
|
def start input
|
34
36
|
super
|
35
|
-
|
36
|
-
|
37
|
+
t = Thread.new do
|
38
|
+
loop do
|
39
|
+
if osx?
|
40
|
+
kernel.system("afplay #{nyan_mp3} &")
|
41
|
+
elsif linux?
|
42
|
+
play_on_linux
|
43
|
+
end
|
44
|
+
Thread.current["started_playing"] ||= true
|
45
|
+
sleep MUSIC_LENGTH
|
46
|
+
end
|
47
|
+
end
|
48
|
+
until t["started_playing"]
|
49
|
+
sleep 0.001
|
50
|
+
end
|
37
51
|
end
|
38
52
|
|
39
53
|
def kill_music
|
40
54
|
if File.exists? nyan_mp3
|
41
|
-
|
42
|
-
|
55
|
+
if osx?
|
56
|
+
system("killall -9 afplay &>/dev/null")
|
57
|
+
elsif linux?
|
58
|
+
kill_music_on_linux
|
59
|
+
end
|
43
60
|
end
|
44
61
|
end
|
45
62
|
|
46
63
|
private
|
47
|
-
|
64
|
+
|
48
65
|
def play_on_linux
|
49
66
|
kernel.system("[ -e #{nyan_mp3} ] && type mpg321 &>/dev/null && mpg321 #{nyan_mp3} &>/dev/null &") if kernel.system('which mpg321 &>/dev/null && type mpg321 &>/dev/null')
|
50
67
|
kernel.system("[ -e #{nyan_mp3} ] && type mpg123 &>/dev/null && mpg123 #{nyan_mp3} &>/dev/null &") if kernel.system('which mpg123 &>/dev/null && type mpg123 &>/dev/null')
|
51
68
|
end
|
52
69
|
|
53
|
-
def kill_music_on_linux
|
70
|
+
def kill_music_on_linux
|
54
71
|
system("killall -9 mpg321 &>/dev/null") if kernel.system("which mpg321 &>/dev/null && type mpg321 &>/dev/null")
|
55
72
|
system("killall -9 mpg123 &>/dev/null") if kernel.system("which mpg123 &>/dev/null && type mpg123 &>/dev/null")
|
56
73
|
end
|
data/nyan-cat-formatter.gemspec
CHANGED
data/nyan_example.gif
ADDED
Binary file
|
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.4.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: 2013-02-
|
12
|
+
date: 2013-02-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -67,6 +67,7 @@ files:
|
|
67
67
|
- lib/nyan_cat_music_formatter.rb
|
68
68
|
- lib/nyan_cat_wide_formatter.rb
|
69
69
|
- nyan-cat-formatter.gemspec
|
70
|
+
- nyan_example.gif
|
70
71
|
- spec/nyan_cat_formatter_spec.rb
|
71
72
|
- spec/nyan_cat_music_formatter_spec.rb
|
72
73
|
- spec/nyan_cat_wide_formatter_spec.rb
|