Module: Burr::Server

Includes:
WEBrick
Defined in:
lib/burr/server.rb

Class Method Summary collapse

Class Method Details

.start!Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/burr/server.rb', line 8

def self.start!
  destination = File.join(Dir.pwd, '/outputs/site')

  # recreate NondisclosureName under utf-8 circumstance
  fh_option = WEBrick::Config::FileHandler
  fh_option[:NondisclosureName] = ['.ht*','~*']

  s = HTTPServer.new(
    :Port => 8000,
    :BindAddress => '0.0.0.0',
  )

  s.mount('/', HTTPServlet::FileHandler, destination, fh_option)
  t = Thread.new { s.start }
  trap("INT") { s.shutdown }
  t.join()
end