class Amber::Server

Attributes

port[R]
site[R]

Public Class Methods

new(options) click to toggle source
# File lib/amber/server.rb, line 16
def initialize(options)
  @site = options[:site]
  @host = options[:host]
  @port = options[:port]
  @server = WEBrick::HTTPServer.new :Port => @port, :BindAddress => @host, :DocumentRoot => @site.dest_dir
  @server.mount '/', StaticPageServlet, self
end
start(options) click to toggle source
# File lib/amber/server.rb, line 12
def self.start(options)
  Server.new(options).start
end

Public Instance Methods

start() click to toggle source
# File lib/amber/server.rb, line 24
def start
  trap 'INT' do
    @server.shutdown
  end
  @server.start
end