1
0
Fork 0
mirror of https://github.com/Oreolek/undum.git synced 2024-05-04 18:18:15 +03:00
undum/test_webservers/serve.rb

18 lines
391 B
Ruby
Executable file

#!/usr/bin/env ruby
require 'webrick'
include WEBrick
def start_webrick(config={})
config.update(:Port => 8000)
puts "Server starting. Visit http://localhost:8000/ in your browser."
server = HTTPServer.new(config)
yield server if block_given?
['INT', 'TERM'].each { |signal|
trap(signal){ server.shutdown}
}
server.start
end
start_webrick(:DocumentRoot => '../games')