Skip to content

Instantly share code, notes, and snippets.

@jbarnette
Created February 8, 2012 19:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbarnette/1772804 to your computer and use it in GitHub Desktop.
Save jbarnette/1772804 to your computer and use it in GitHub Desktop.
require "bundler/setup"
require "rack/streaming_proxy"
warn "Sleeping for a bit before starting gimme."
sleep 3
warn "Starting gimme."
nport = 2727
nenv = ENV.to_hash.merge "PORT" => nport.to_s
npid = Process.spawn nenv, "coffee index.coffee", err: :out, out: $stdout
sleep 3
warn "Gimme should be started by now."
Signal.trap "QUIT" do
warn "SIGQUIT received, killing gimme."
Process.kill "QUIT", npid
end
use Rack::StreamingProxy do |req|
"http://localhost:#{nport}#{req.path}"
end
run lambda { |env|
[200, { "Content-Type" => "text/plain" }, ["Wut."]]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment