Skip to content

Instantly share code, notes, and snippets.

@TonyStrauss
TonyStrauss / unicorn_reloader
Created February 22, 2011 23:09
Development mode for unicorn (based upon Jonathan Stott's watcher.rb)
#!/usr/bin/env ruby
#
# unicorn_reloader
#
# spawns a unicorn to serve a rack app in the given directory. Watches
# the app files for changes, restarting the unicorn worker when they're
# detected.
#
# Tony Strauss <tony at animoto.com>
# Forked in order to:
temp_dir: '/tmp/'
segment_prefix: 'sample'
index_prefix: 'stream'
# type of logging: STDOUT, FILE
log_type: 'STDOUT'
#log_type: 'FILE'
#log_file: '/tmp/streamer.log'
# levels: DEBUG, INFO, WARN, ERROR
log_level: 'DEBUG'
require 'v8'
JS = <<EOF
Foo = function() {
throw new Error("BOOG1");
};
function bar() {
throw new Error("BOOG2");
etrog:~/slideshow_director tony$ bundle exec test3.rb boog.json
======================================================================
Ruby:
{:sections=>
[{:values=>
[[0.8, 0.014, 7.282, 2.0],
[1.3, 0.01, 1.548, 4.0],
[1.74, 0.009, 1.226, 4.0],
[2.16, 0.015, 2.148, 4.0],
[2.6, 0.011, 1.283, 4.0],