Create a gist now

Instantly share code, notes, and snippets.

@cotapon /build.rb forked from deguchi/build.rb
Created Feb 20, 2013

What would you like to do?
# original
# thanks hakobe!
# Macで動作確認。Windowsの場合、spawnを使うとよいらしい。 参考:
require 'webrick'
server ={
:DocumentRoot => nil,
:BindAddress => '',
:Port => 9090
['INT', 'TERM'].each {|signal|
Signal.trap(signal){ server.shutdown }
last_pid = nil
server.mount_proc("/run") { |req, res|
if last_pid
Process.kill('KILL', last_pid)
last_pid = fork do
exec "ti build -p iphone"
# system "coffee -o "+Dir.pwd+"/Resources/js/ -c "+Dir.pwd+"/Resources/coffee/"
res["content-type"] = "text/html; charset=utf-8"
res.body = "ok"
warn 'starting server at localhost:9090'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment