nyan-cat-formatter 0.1.0 → 0.2.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
CHANGED
@@ -73,7 +73,7 @@ Make sure your .rspec file in your application's root directory contains the fol
|
|
73
73
|
|
74
74
|
Then run `rspec spec` and enjoy Nyan Cat formatted text output accompanied by the Nyan Cat song by default!
|
75
75
|
|
76
|
-
**This currently only works on Mac OS X or on Linux (if you have mpg321 installed).**
|
76
|
+
**This currently only works on Mac OS X or on Linux (if you have mpg321 or mpg123 installed).**
|
77
77
|
|
78
78
|
Contributing
|
79
79
|
----------
|
@@ -40,7 +40,7 @@ module RSpec1
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def dump_summary(duration, example_count, failure_count, pending_count)
|
43
|
-
NyanCatMusicFormatter.new(NyanCatFormatter).kill_music if NyanCatMusicFormatter
|
43
|
+
NyanCatMusicFormatter.new(NyanCatFormatter).kill_music if defined?(NyanCatMusicFormatter)
|
44
44
|
@output.puts "\nYou've Nyaned for #{format_duration(duration)}\n".each_char.map {|c| rainbowify(c)}.join
|
45
45
|
summary = "#{example_count} example#{'s' unless example_count == 1}, #{failure_count} failure#{'s' unless failure_count == 1}"
|
46
46
|
summary << ", #{pending_count} pending" if pending_count > 0
|
@@ -28,7 +28,7 @@ module RSpec2
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def dump_summary(duration, example_count, failure_count, pending_count)
|
31
|
-
NyanCatMusicFormatter.new(NyanCatFormatter).kill_music if NyanCatMusicFormatter
|
31
|
+
NyanCatMusicFormatter.new(NyanCatFormatter).kill_music if defined?(NyanCatMusicFormatter)
|
32
32
|
dump_profile if profile_examples? && failure_count == 0
|
33
33
|
summary = "\nYou've Nyaned for #{format_duration(duration)}\n".split(//).map { |c| rainbowify(c) }
|
34
34
|
output.puts summary.join
|
@@ -33,13 +33,26 @@ NyanCatMusicFormatter = Class.new(NyanCatFormatter) do
|
|
33
33
|
def start input
|
34
34
|
super
|
35
35
|
kernel.system("afplay #{nyan_mp3} &") if osx?
|
36
|
-
|
36
|
+
play_on_linux if linux?
|
37
37
|
end
|
38
38
|
|
39
39
|
def kill_music
|
40
40
|
if File.exists? nyan_mp3
|
41
41
|
system("killall -9 afplay &>/dev/null") if osx?
|
42
|
-
|
42
|
+
kill_music_on_linux if linux?
|
43
43
|
end
|
44
44
|
end
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
def play_on_linux
|
49
|
+
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
|
+
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
|
+
end
|
52
|
+
|
53
|
+
def kill_music_on_linux
|
54
|
+
system("killall -9 mpg321 &>/dev/null") if kernel.system("which mpg321 &>/dev/null && type mpg321 &>/dev/null")
|
55
|
+
system("killall -9 mpg123 &>/dev/null") if kernel.system("which mpg123 &>/dev/null && type mpg123 &>/dev/null")
|
56
|
+
end
|
57
|
+
|
45
58
|
end
|
data/nyan-cat-formatter.gemspec
CHANGED
@@ -69,6 +69,7 @@ describe NyanCatMusicFormatter do
|
|
69
69
|
it 'plays the song for linux too' do
|
70
70
|
formatter.start 10
|
71
71
|
mock_kernel.seen.any? { |entry| entry. end_with? "mpg321 #{path_to_mp3} &>/dev/null &" }.should be
|
72
|
+
mock_kernel.seen.any? { |entry| entry. end_with? "mpg123 #{path_to_mp3} &>/dev/null &" }.should be
|
72
73
|
end
|
73
74
|
end
|
74
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.2.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: 2012-
|
12
|
+
date: 2012-10-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|