lib/smallcage/commands/server.rb in smallcage-0.0.8 vs lib/smallcage/commands/server.rb in smallcage-0.0.9
- old
+ new
@@ -1,24 +1,15 @@
-require 'webrick'
-
module SmallCage::Commands
class Server
def self.execute(opts)
document_root = opts[:path]
port = opts[:port]
-
- server = WEBrick::HTTPServer.new({
- :DocumentRoot => document_root,
- :Port => port
- })
-
- WEBrick::HTTPServlet::FileHandler.remove_handler("cgi")
- WEBrick::HTTPServlet::FileHandler.remove_handler("rhtml")
- ['INT', 'TERM'].each do |signal|
- Signal.trap(signal){ server.shutdown }
- end
- server.start
+ server = SmallCage::HTTPServer.new(document_root, port)
+
+ sighandler = Proc.new {|signal| server.shutdown}
+ SmallCage::Application.add_signal_handler(["INT", "TERM"], sighandler)
+ server.start
end
end
end
\ No newline at end of file