Skip to content

Instantly share code, notes, and snippets.

@moro
Created September 12, 2008 06:38
Show Gist options
  • Save moro/10391 to your computer and use it in GitHub Desktop.
Save moro/10391 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# vim:set fileencoding=utf-8 filetype=ruby
$KCODE = 'u'
require 'webrick/httpserver'
s = WEBrick::HTTPServer.new(:Port=>3030)
s.mount_proc("/deploy") do |req, res|
IO.popen("cap deploy"){|x| res.body = x.read }
res.status = ($? == 0 ? WEBrick::HTTPStatus::OK : WEBrick::HTTPStatus::BadRequest).code
end
trap("INT"){ s.shutdown }
s.start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment