nyan-cat-formatter 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,12 +1,7 @@
1
1
  Nyan Cat RSpec Formatter [![Build Status](https://secure.travis-ci.org/mattsears/nyan-cat-formatter.png)](http://travis-ci.org/mattsears/nyan-cat-formatter)
2
2
  ========
3
3
 
4
- ```
5
- -_-_-_-_-_-_-_,------,
6
- _-_-_-_-_-_-_-| /\_/\
7
- -_-_-_-_-_-_-~|__( ^ .^)
8
- _-_-_-_-_-_-_-"" ""
9
- ```
4
+ ![NYAN](nyan_example.gif)
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](https://wwww.mattsears.com) :: @mattsears
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
- kernel.system("afplay #{nyan_mp3} &") if osx?
36
- play_on_linux if linux?
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
- system("killall -9 afplay &>/dev/null") if osx?
42
- kill_music_on_linux if linux?
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
@@ -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.3.0"
5
+ s.version = "0.4.0"
6
6
  s.authors = ["Matt Sears"]
7
7
  s.email = ["matt@mattsears.com"]
8
8
  s.homepage = "http://mtts.rs/nyancat"
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.3.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-10 00:00:00.000000000 Z
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