multi-godlike 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/README.markdown +50 -0
- data/Rakefile +29 -0
- data/VERSION +1 -0
- data/bin/playsound +0 -0
- data/lib/godlike.rb +86 -0
- data/lib/godlike/sounds/flag_capture.mp3 +0 -0
- data/lib/godlike/sounds/frag.mp3 +0 -0
- data/lib/godlike/sounds/godlike.mp3 +0 -0
- data/lib/godlike/sounds/headshot.mp3 +0 -0
- data/lib/godlike/sounds/killingspree.mp3 +0 -0
- data/lib/godlike/sounds/perfect.mp3 +0 -0
- data/lib/godlike/sounds/supreme_victory.mp3 +0 -0
- data/lib/godlike/sounds/ultrakill.mp3 +0 -0
- data/test/godlike_test.rb +8 -0
- data/test/test_helper.rb +6 -0
- metadata +85 -0
data/.gitignore
ADDED
data/README.markdown
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# Godlike
|
2
|
+
|
3
|
+
The best autotest add on ever. Its motivational. Its awesome. Its Godlike. Godlike is an autotest hook that places cool sounds when you acheive 100% test passing rate. The default sound is the Unreal Tournament voice: GODLIKE
|
4
|
+
|
5
|
+
## Requirements
|
6
|
+
|
7
|
+
Godlike only works for Macs because they are the most god like.
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
sudo gem install gemcutter
|
12
|
+
sudo gem tumble
|
13
|
+
sudo gem install godlike
|
14
|
+
|
15
|
+
# .autotest
|
16
|
+
require 'godlike'
|
17
|
+
|
18
|
+
## Customization
|
19
|
+
|
20
|
+
You can choose any of the few cools sounds I've included in the gem.
|
21
|
+
|
22
|
+
* godlike.mp3
|
23
|
+
* headshot.mp3
|
24
|
+
* killingspree.mp3
|
25
|
+
* perfect.mp3
|
26
|
+
* supreme_victory.mp3
|
27
|
+
* ultrakill.mp3
|
28
|
+
* frag.mp3
|
29
|
+
* flag_capture.mp3
|
30
|
+
|
31
|
+
Set the GODLIKE_SOUND consant in your autotest file
|
32
|
+
|
33
|
+
require 'godlike'
|
34
|
+
GODLIKE_SOUND = 'supreme_victory' # leave off extension
|
35
|
+
# Note, you can also provided an absolute path to play your own sounds
|
36
|
+
|
37
|
+
Or set to a proc:
|
38
|
+
|
39
|
+
sounds = %w[godlike headshot killingspree perfect supreme_victory ultrakill flag_capture frag]
|
40
|
+
GODLIKE_SOUND = proc { sounds[(sounds.size*rand).to_i] }
|
41
|
+
# Pic a sound at random each time
|
42
|
+
|
43
|
+
|
44
|
+
## Notes
|
45
|
+
The Autotest hook :all\_good was firing even on failure for me so I've changed it to use the :ran\_command hook plus some checks. -Arthur
|
46
|
+
|
47
|
+
Big thanks to [Carlos Brando](http://github.com/carlosbrando/autotest-notification) for writing the cocoa script to play audio.
|
48
|
+
|
49
|
+
|
50
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/testtask'
|
3
|
+
require 'rake/rdoctask'
|
4
|
+
|
5
|
+
desc 'Default: run unit tests.'
|
6
|
+
task :default => :test
|
7
|
+
|
8
|
+
desc 'Test the godlike plugin.'
|
9
|
+
Rake::TestTask.new(:test) do |t|
|
10
|
+
t.libs << 'lib'
|
11
|
+
t.libs << 'test'
|
12
|
+
t.pattern = 'test/**/*_test.rb'
|
13
|
+
t.verbose = true
|
14
|
+
end
|
15
|
+
|
16
|
+
begin
|
17
|
+
require 'jeweler'
|
18
|
+
Jeweler::Tasks.new do |gemspec|
|
19
|
+
gemspec.name = "multi-godlike"
|
20
|
+
gemspec.summary = "Feel godly after your tests"
|
21
|
+
gemspec.description = "Announcers can be motivating. \n Forked from a fork from a fork....Follow the github chain for more."
|
22
|
+
gemspec.email = "jon@burningbush.us"
|
23
|
+
gemspec.homepage = "http://github.com/jmoses/godlike"
|
24
|
+
gemspec.authors = ["Jon Moses"]
|
25
|
+
Jeweler::GemcutterTasks.new
|
26
|
+
end
|
27
|
+
rescue LoadError
|
28
|
+
puts "Jeweler not available. Install it with: sudo gem install jeweler"
|
29
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.0.0
|
data/bin/playsound
ADDED
Binary file
|
data/lib/godlike.rb
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
# Godlike
|
2
|
+
# Extracted code from Carlos Brando's autotest notifications
|
3
|
+
# Wanted to make something easy that would play a cool sound
|
4
|
+
# after a successful test run
|
5
|
+
# aka: GODLIKE
|
6
|
+
|
7
|
+
module Godlike
|
8
|
+
extend self
|
9
|
+
|
10
|
+
def play_sound sound_file
|
11
|
+
Thread.new { `#{File.expand_path(File.dirname(__FILE__) + "/../bin/")}/playsound #{sound_file}` }
|
12
|
+
end
|
13
|
+
|
14
|
+
def success
|
15
|
+
sound_file = ""
|
16
|
+
sounds_directory = "#{File.dirname(__FILE__)}/godlike/sounds"
|
17
|
+
|
18
|
+
if defined?(GODLIKE_SOUND)
|
19
|
+
sound_name = GODLIKE_SOUND.is_a?(Proc) ? GODLIKE_SOUND.call : GODLIKE_SOUND
|
20
|
+
if File.exists? "#{sounds_directory}/#{sound_name}.mp3"
|
21
|
+
sound_file = "#{sounds_directory}/#{sound_name}.mp3"
|
22
|
+
else
|
23
|
+
sound_file = sound_name
|
24
|
+
end
|
25
|
+
else
|
26
|
+
sound_file = "#{sounds_directory}/godlike.mp3"
|
27
|
+
end
|
28
|
+
play_sound(sound_file)
|
29
|
+
end
|
30
|
+
|
31
|
+
def fail
|
32
|
+
# do nothing
|
33
|
+
end
|
34
|
+
|
35
|
+
def pending
|
36
|
+
# do nothing
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
if defined?(Autotest)
|
41
|
+
Autotest.add_hook :ran_command do |autotest|
|
42
|
+
result = Result.new(autotest)
|
43
|
+
if result.exists?
|
44
|
+
if result.has?('test-error') || result.has?('test-failed') || result.has?('example-failed')
|
45
|
+
Godlike.fail
|
46
|
+
elsif result.has?('example-pending')
|
47
|
+
Godlike.pending
|
48
|
+
else
|
49
|
+
Godlike.success
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
if defined?(LeftRight)
|
56
|
+
require 'active_support'
|
57
|
+
module LeftRight
|
58
|
+
class Runner < Test::Unit::UI::Console::TestRunner
|
59
|
+
def finished_with_sound(elapsed_time)
|
60
|
+
passed_count = @result.run_count -
|
61
|
+
@result.failure_count -
|
62
|
+
@result.error_count - lr.state.skipped_count
|
63
|
+
if passed_count > 0 && @result.failure_count.zero? && @result.error_count.zero?
|
64
|
+
Godlike.success
|
65
|
+
end
|
66
|
+
finished_without_sound(elapsed_time)
|
67
|
+
end
|
68
|
+
alias_method_chain :finished, :sound
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
if defined?(Test::Unit)
|
74
|
+
require 'test/unit/ui/console/testrunner'
|
75
|
+
require 'active_support'
|
76
|
+
|
77
|
+
class Test::Unit::UI::Console::TestRunner
|
78
|
+
def finished_with_sound(elapsed_time)
|
79
|
+
if @faults.empty?
|
80
|
+
Godlike.success
|
81
|
+
end
|
82
|
+
finished_without_sound(elapsed_time)
|
83
|
+
end
|
84
|
+
alias_method_chain :finished, :sound
|
85
|
+
end
|
86
|
+
end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/test/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: multi-godlike
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
- 0
|
10
|
+
version: 1.0.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Jon Moses
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-08-25 00:00:00 -04:00
|
19
|
+
default_executable: playsound
|
20
|
+
dependencies: []
|
21
|
+
|
22
|
+
description: |-
|
23
|
+
Announcers can be motivating.
|
24
|
+
Forked from a fork from a fork....Follow the github chain for more.
|
25
|
+
email: jon@burningbush.us
|
26
|
+
executables:
|
27
|
+
- playsound
|
28
|
+
extensions: []
|
29
|
+
|
30
|
+
extra_rdoc_files:
|
31
|
+
- README.markdown
|
32
|
+
files:
|
33
|
+
- .gitignore
|
34
|
+
- README.markdown
|
35
|
+
- Rakefile
|
36
|
+
- VERSION
|
37
|
+
- bin/playsound
|
38
|
+
- lib/godlike.rb
|
39
|
+
- lib/godlike/sounds/flag_capture.mp3
|
40
|
+
- lib/godlike/sounds/frag.mp3
|
41
|
+
- lib/godlike/sounds/godlike.mp3
|
42
|
+
- lib/godlike/sounds/headshot.mp3
|
43
|
+
- lib/godlike/sounds/killingspree.mp3
|
44
|
+
- lib/godlike/sounds/perfect.mp3
|
45
|
+
- lib/godlike/sounds/supreme_victory.mp3
|
46
|
+
- lib/godlike/sounds/ultrakill.mp3
|
47
|
+
- test/godlike_test.rb
|
48
|
+
- test/test_helper.rb
|
49
|
+
has_rdoc: true
|
50
|
+
homepage: http://github.com/jmoses/godlike
|
51
|
+
licenses: []
|
52
|
+
|
53
|
+
post_install_message:
|
54
|
+
rdoc_options:
|
55
|
+
- --charset=UTF-8
|
56
|
+
require_paths:
|
57
|
+
- lib
|
58
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
59
|
+
none: false
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
hash: 3
|
64
|
+
segments:
|
65
|
+
- 0
|
66
|
+
version: "0"
|
67
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
|
+
none: false
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
hash: 3
|
73
|
+
segments:
|
74
|
+
- 0
|
75
|
+
version: "0"
|
76
|
+
requirements: []
|
77
|
+
|
78
|
+
rubyforge_project:
|
79
|
+
rubygems_version: 1.3.7
|
80
|
+
signing_key:
|
81
|
+
specification_version: 3
|
82
|
+
summary: Feel godly after your tests
|
83
|
+
test_files:
|
84
|
+
- test/godlike_test.rb
|
85
|
+
- test/test_helper.rb
|