Created
March 25, 2013 20:07
-
-
Save jwelshiv/5240230 to your computer and use it in GitHub Desktop.
Tail heroku logs and make sound when match found
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# brew install portaudio | |
# gem install bloopsaphone | |
require 'bloops' | |
# the bloops o' phone | |
bloops = Bloops.new | |
bloops.tempo = 150 | |
# beats | |
simpsons = bloops.sound Bloops::SQUARE | |
# Simpsons | |
bloops.tune simpsons, "32 + C E F# 8:A G E C - 8:A 8:F# 8:F# 8:F# 2:G" | |
input = ARGV[0] || 'heroku logs --tail --app dev-instacanvas' | |
matcher = ARGV[1] || '/my-cart/complete' | |
IO.popen(input) do |io| | |
io.each do |out| | |
if out.match matcher | |
bloops.play | |
puts out | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment