I am trying to serve up static content for some web development, with a few lines of erb to simulate what the real server will do. I already did this with WEBrick here: http://ceronio.net/2011/06/nice-web-server-script-to-server-any-directory-using-webrick, but now I want to do this with Mongrel.
My code so far is like this:
#!/usr/bin/ruby
require 'rubygems'
require 'mongrel'
Mongrel::DirHandler.add_mime_type('.rhtml', 'text/html')
server = Mongrel::HttpServer.new("localhost", 2000)
server.register("/", Mongrel::DirHandler.new(Dir::pwd))
server_thread = server.run
server_thread.join
But when I access my index.rhtml file, it does not process the content in the <% %> tags, but just passes the file as is to the browser.
With WEBrick, nothing additional was required. What do I need to do here to get the server-side Ruby code processed in the .rhtml file?