require 'tofu/tofulet'
require 'drb/drb'
require 'rinda/ring'
require 'tofu/ring'

def main
  DRb.start_service

  logger = WEBrick::Log::new($stderr, WEBrick::Log::DEBUG)

  s = WEBrick::HTTPServer.new(:Port => 2000,
			      :AddressFamily => Socket::AF_INET,
			      :BindAddress => ENV['HOSTNAME'],
			      :Logger => logger)

  ring = Tofu::RingTofuletProvider.new(s)
  ring.join

  s.mount('/~seki/tdiary-theme', WEBrick::HTTPServlet::FileHandler,
	  '/home/mas/public_html/tdiary-theme', nil)

  trap("INT"){ s.shutdown }
  s.start
end

main
