#!/usr/bin/env ruby
require 'webrick'
include WEBrick
 
module WEBrick::HTTPServlet
  FileHandler.add_handler('rb', CGIHandler)
  FileHandler.add_handler('sh', CGIHandler)
  FileHandler.add_handler('cgi', CGIHandler)
end
 
s = HTTPServer.new(
  :Port => (ENV["PORT"]||3000),
  :DocumentRoot => ENV["DOCROOT"]||"."
)
trap("INT") { s.shutdown }
s.start