require 'rw-view'
require 'rw-edit'
require 'tofu/ring'

puts("phrase:")
phrase = gets.chomp
RWikiEditSession::LoginDiv.phrase = phrase

DRb.start_service
  
view = Tofu::Bartender.new(RWikiViewSession)
edit = Tofu::Bartender.new(RWikiEditSession)

ts = Rinda::RingFinger.primary

finder = Tofu::RingTofuletFinder.new(ts)
th = Thread.new do
  finder.each do |tuple|
    webrick = tuple[2]
    webrick.mount('/static', DRbObject.new(view))
    webrick.mount('/edit', DRbObject.new(edit))
  end
end

while gets
  Div.reload_erb
end
