On 9/20/06, zerohalo <zerohalo / gmail.com> wrote:
> Yes, I tried that. Unfortunately there is no documentation on the
> webrick site on how to use ERBHandler. I have this in a ruby script
> which does start up the Webrick server. However, while it serves HTML
> files fine, it treats RHTML files as binaries and RB files as just
> plain text. Here's my code:

require 'webrick'
include WEBrick

def start_webrick(config = {})
  config.update(:Port => 8080)
+  config.update(:MimeTypes => {'rhtml' => 'text/html'})
  server = HTTPServer.new(config)
  yield server if block_given?
  ['INT', 'TERM'].each {|signal|
    trap(signal) {server.shutdown}
  }
-  ruby_dir = File.expand_path('/data/sandbox/ruby')
-  server.mount("/data/sandbox/ruby", HTTPServlet::ERBHandler, ruby_dir)
  server.start
end

start_webrick(:DocumentRoot => '/data/sandbox/ruby')