app-racket 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,3 @@
1
+ dummy.log
2
+ *.swp
3
+ *.gem
@@ -0,0 +1,61 @@
1
+ ## Racket
2
+ ### Listen to your app.
3
+
4
+ Warning: very untested and hacky, may cause blindness, etc, etc.
5
+
6
+ Ever wanted a completely ambient view of your app's performance and progress?
7
+ Racket lets you step back and experience your applications' events as pure light
8
+ and sound. Potentially great for pattern discovery, team morale, and stoner parties.
9
+ Racket uses a custom logfile format, but could be extended to read any line-based
10
+ log file, a la gltail.
11
+
12
+ Sounds live in the "sounds" directory; wav, mp3, aiff and even wacky formats like OggVorbis are supported.
13
+
14
+ Events and corresponding reactions are defined in `config/matcher.rb`
15
+
16
+ ## Installing:
17
+
18
+ ./install_dependencies.sh
19
+
20
+ ## Usage:
21
+
22
+ # start your web-app, or simulate it:
23
+ ./bin/event_simulator > dummy.log &
24
+
25
+ # run app-racket with rsdl wrapper:
26
+ rsdl bin/racket dummy.log
27
+
28
+ # bask in the insanity of your app's racket!
29
+
30
+ ## TODO:
31
+ * implement tailing over ssh, a la GlTail
32
+ * implement light control via [arduino](http://rad.rubyforge.org/)
33
+ * figure out if syslog is what we want for aggregate logfiles from
34
+ multiple apps/servers into a single stream
35
+
36
+ ## Acknowledgements:
37
+ Thanks to the author of the original "sonic compiler" paper, wherever you are. Also thanks to
38
+ [formalplay](http://formalplay.com),
39
+ [jacius](http://github.com/jacius),
40
+ [fudgie](http://www.fudgie.org),
41
+ [stamen](http://stamen.com/),
42
+ [slowmotionlandscape](http://companypolicy.tv),
43
+ the [monome kids](http://monome.org/),
44
+ and [ambient devices](http://ambientdevices.myshopify.com/products/stock-orb)
45
+ for inspiration.
46
+
47
+ ## Notes on installation:
48
+ Playing audio in Ruby is much messier than I expected before starting
49
+ this project, especially having seen things like Giles' archeopteryx.
50
+ Racket depends on several external libraries, primarily because
51
+ SDL (the cross-platform multimedia library) itself depends on several
52
+ obscure audio format decoders to even play simple files, e.g. Ogg
53
+ Vorbis and MikMod.
54
+
55
+ On top of those, on OS X SDL also requires a ruby wrapper called
56
+ rsdl, plus we interface to SDL from ruby via something called
57
+ rubygame, which itself requires things like the FFI gems.
58
+
59
+ But fear not: the racket installer script handles all that
60
+ for you. On my MacBook Pro the full shebang takes about 4m45s to
61
+ download, compile, and install everything, which isn't bad.
@@ -0,0 +1,30 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'rake/rdoctask'
4
+
5
+ GEM_NAME = "app-racket"
6
+ AUTHORS = ["John Manoogian III", "Erik Michaels-Ober"]
7
+ EMAIL = "jm3@jm3.net"
8
+ HOMEPAGE = "http://github.com/jm3/racket"
9
+ SUMMARY = "Listen to your app."
10
+
11
+ begin
12
+ require 'jeweler'
13
+ Jeweler::Tasks.new do |gemspec|
14
+ gemspec.name = GEM_NAME
15
+ gemspec.summary = SUMMARY
16
+ gemspec.description = gemspec.summary
17
+ gemspec.authors = AUTHORS
18
+ gemspec.email = EMAIL
19
+ gemspec.homepage = HOMEPAGE
20
+ gemspec.bindir = "bin"
21
+ gemspec.executables = ["app-racket"]
22
+ gemspec.default_executable = "app-racket"
23
+ gemspec.add_dependency("rsdl", ">= 0.1.2")
24
+ gemspec.add_dependency("rubygame", ">= 2.6.2")
25
+ gemspec.add_dependency("file-tail", ">= 1.0.4")
26
+ end
27
+ Jeweler::GemcutterTasks.new
28
+ rescue LoadError
29
+ puts "Jeweler not available. Install it with: gem install jeweler"
30
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,67 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{app-racket}
8
+ s.version = "0.1.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["John Manoogian III", "Erik Michaels-Ober"]
12
+ s.date = %q{2009-11-21}
13
+ s.default_executable = %q{app-racket}
14
+ s.description = %q{Listen to your app.}
15
+ s.email = %q{jm3@jm3.net}
16
+ s.executables = ["app-racket"]
17
+ s.extra_rdoc_files = [
18
+ "README.markdown"
19
+ ]
20
+ s.files = [
21
+ ".gitignore",
22
+ "README.markdown",
23
+ "Rakefile",
24
+ "VERSION",
25
+ "bin/event_simulator",
26
+ "bin/app-racket",
27
+ "config/matcher.rb",
28
+ "install_dependencies.sh",
29
+ "app-racket.gemspec",
30
+ "sounds/bing-bong.wav",
31
+ "sounds/notify_cardinal1.aiff",
32
+ "sounds/notify_cardinal2.aiff",
33
+ "sounds/notify_original.aiff",
34
+ "sounds/notify_robin.aiff",
35
+ "sounds/phasing-bendy-bells.wav",
36
+ "sounds/savage.wav",
37
+ "sounds/skwlechy.wav",
38
+ "sounds/squeaks.wav",
39
+ "sounds/tiny-bubbles.mp3",
40
+ "sounds/winding-weird-loop.wav"
41
+ ]
42
+ s.homepage = %q{http://github.com/jm3/racket}
43
+ s.rdoc_options = ["--charset=UTF-8"]
44
+ s.require_paths = ["lib"]
45
+ s.rubygems_version = %q{1.3.5}
46
+ s.summary = %q{Listen to your app.}
47
+
48
+ if s.respond_to? :specification_version then
49
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
50
+ s.specification_version = 3
51
+
52
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
53
+ s.add_runtime_dependency(%q<rsdl>, [">= 0.1.2"])
54
+ s.add_runtime_dependency(%q<rubygame>, [">= 2.6.2"])
55
+ s.add_runtime_dependency(%q<file-tail>, [">= 1.0.4"])
56
+ else
57
+ s.add_dependency(%q<rsdl>, [">= 0.1.2"])
58
+ s.add_dependency(%q<rubygame>, [">= 2.6.2"])
59
+ s.add_dependency(%q<file-tail>, [">= 1.0.4"])
60
+ end
61
+ else
62
+ s.add_dependency(%q<rsdl>, [">= 0.1.2"])
63
+ s.add_dependency(%q<rubygame>, [">= 2.6.2"])
64
+ s.add_dependency(%q<file-tail>, [">= 1.0.4"])
65
+ end
66
+ end
67
+
@@ -0,0 +1,82 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'rubygame'
5
+ require 'file/tail'
6
+ require 'singleton'
7
+ include Rubygame
8
+
9
+ class Racket
10
+ include Singleton
11
+ attr_accessor :events
12
+
13
+ def initialize
14
+ @events = []
15
+ end
16
+
17
+ # Push an event to the bottom of the stack.
18
+ def push(event)
19
+ @events.push(event)
20
+ end
21
+
22
+ # Removes the top-most event.
23
+ def pop
24
+ @events.pop
25
+ end
26
+ end
27
+
28
+ class Event
29
+ attr_accessor :regex, :description, :reaction
30
+
31
+ def initialize(regex, description)
32
+ @regex = regex
33
+ @description = description
34
+ end
35
+
36
+ def play(sound)
37
+ @reaction = Reaction.new(sound)
38
+ end
39
+
40
+ def to_s
41
+ "#{description}\n"
42
+ end
43
+ end
44
+
45
+ class Reaction
46
+ attr_accessor :sound
47
+
48
+ def initialize(sound)
49
+ @sound = "sounds/#{sound}"
50
+ end
51
+ end
52
+
53
+ Rubygame.init
54
+
55
+ def match(regex, description)
56
+ @racket = Racket.instance
57
+ @event = Event.new(regex, description)
58
+ @racket.push(@event)
59
+ @event
60
+ end
61
+
62
+ def run
63
+ # puts "Using audio driver:" + Rubygame.audio_driver
64
+ Sound.autoload_dirs = ["sounds"]
65
+
66
+ require 'config/matcher'
67
+
68
+ @file = File.open(ARGV.first)
69
+ @file.extend(File::Tail)
70
+ @file.tail do |line|
71
+ @racket.events.each do |event|
72
+ if line.match(event.regex)
73
+ puts event
74
+ Sound.load(event.reaction.sound).play
75
+ end
76
+ end
77
+ end
78
+ end
79
+
80
+ event_thread = Thread.new{run}
81
+ event_thread.join
82
+ Rubygame.quit
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ # generate a fake stream of events for testing
3
+
4
+ events = [
5
+ 'tweet',
6
+ 'signup',
7
+ 'invite',
8
+ 'login',
9
+ 'error',
10
+ ]
11
+
12
+ while true
13
+ puts "#{Time.now}, #{events[rand(events.size)]}"
14
+ $stdout.flush
15
+ sleep(rand(3) + 1)
16
+ end
@@ -0,0 +1,14 @@
1
+ match(/tweet/, ":) Someone just tweeted!").
2
+ play("bird_1.aiff")
3
+
4
+ match(/signup/, ":) Someone just signed up!").
5
+ play("bird_2.aiff")
6
+
7
+ match(/invite/, ":) Someone just sent an invite!").
8
+ play("bird_3.aiff")
9
+
10
+ match(/login/, ":) Someone just logged in!").
11
+ play("bird_4.aiff")
12
+
13
+ match(/error/, ":( Something bad happened!").
14
+ play("cat.aiff")
@@ -0,0 +1,11 @@
1
+ #!/bin/sh
2
+
3
+ uname=`uname`
4
+ if [ "$uname" = "Darwin" ] ; then
5
+ sudo port -d selfupdate && \
6
+ sudo port clean libsdl && \
7
+ sudo port install libsdl libsdl_gfx libsdl_ttf libsdl_image libogg libvorbis smpeg libmikmod libsdl_mixer libffi
8
+ else
9
+ sudo aptitude update && \
10
+ sudo aptitude install libsdl1.2-dev libogg-dev libogg libvorbis-dev libvorbis
11
+ fi
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
metadata ADDED
@@ -0,0 +1,132 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: app-racket
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - John Manoogian III
14
+ - Erik Michaels-Ober
15
+ autorequire:
16
+ bindir: bin
17
+ cert_chain: []
18
+
19
+ date: 2009-11-21 00:00:00 Z
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: rsdl
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 31
30
+ segments:
31
+ - 0
32
+ - 1
33
+ - 2
34
+ version: 0.1.2
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: rubygame
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ hash: 19
46
+ segments:
47
+ - 2
48
+ - 6
49
+ - 2
50
+ version: 2.6.2
51
+ type: :runtime
52
+ version_requirements: *id002
53
+ - !ruby/object:Gem::Dependency
54
+ name: file-tail
55
+ prerelease: false
56
+ requirement: &id003 !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ hash: 31
62
+ segments:
63
+ - 1
64
+ - 0
65
+ - 4
66
+ version: 1.0.4
67
+ type: :runtime
68
+ version_requirements: *id003
69
+ description: Listen to your app.
70
+ email: jm3@jm3.net
71
+ executables:
72
+ - app-racket
73
+ extensions: []
74
+
75
+ extra_rdoc_files:
76
+ - README.markdown
77
+ files:
78
+ - .gitignore
79
+ - README.markdown
80
+ - Rakefile
81
+ - VERSION
82
+ - bin/event_simulator
83
+ - bin/app-racket
84
+ - config/matcher.rb
85
+ - install_dependencies.sh
86
+ - app-racket.gemspec
87
+ - sounds/bing-bong.wav
88
+ - sounds/notify_cardinal1.aiff
89
+ - sounds/notify_cardinal2.aiff
90
+ - sounds/notify_original.aiff
91
+ - sounds/notify_robin.aiff
92
+ - sounds/phasing-bendy-bells.wav
93
+ - sounds/savage.wav
94
+ - sounds/skwlechy.wav
95
+ - sounds/squeaks.wav
96
+ - sounds/tiny-bubbles.mp3
97
+ - sounds/winding-weird-loop.wav
98
+ homepage: http://github.com/jm3/racket
99
+ licenses: []
100
+
101
+ post_install_message:
102
+ rdoc_options:
103
+ - --charset=UTF-8
104
+ require_paths:
105
+ - lib
106
+ required_ruby_version: !ruby/object:Gem::Requirement
107
+ none: false
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ hash: 3
112
+ segments:
113
+ - 0
114
+ version: "0"
115
+ required_rubygems_version: !ruby/object:Gem::Requirement
116
+ none: false
117
+ requirements:
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ hash: 3
121
+ segments:
122
+ - 0
123
+ version: "0"
124
+ requirements: []
125
+
126
+ rubyforge_project:
127
+ rubygems_version: 1.8.12
128
+ signing_key:
129
+ specification_version: 3
130
+ summary: Listen to your app.
131
+ test_files: []
132
+