28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/amiba/site.rb', line 28
def preview
root = File.expand_path(File.join(Amiba::Configuration.site_dir, "public"))
logger = WEBrick::Log.new($stderr, WEBrick::Log::ERROR)
server = WEBrick::HTTPServer.new({:Port => options[:port], :DocumentRoot => root, :Logger => logger})
['INT', 'TERM'].each {|signal|
trap(signal) {server.shutdown}
}
say ""
say ""
say "Preview available at http://localhost:#{options[:port]}/"
say "To end, press Ctrl+C"
server.start
end
|