#!/usr/bin/ruby # This script assumes that the documents to be served are .rhtml files in the # directory one level up from the one where the script is located. A layout # template named "layouts/default.rhtml" is also assumed to exist in that # directory. # # Of course, this script is completely out of date and incompatible with modern # versions of ActionPack. I might someday fix this code, but right now my # efforts are instead directed toward developing Silkweave # (http://nanoo.org/software/silkweave/), which is a more complete and # sophisticated realization of the ideas explored in this script. require "rubygems" require "action_controller" class DocumentController < ActionController::Base layout "default" def method_missing(path) @path = path.to_s.gsub('__', '/') begin render :template => @path.sub(/\.html$/, '') rescue => e render :text => %Q{

Error: page not found.
There is no valid page named "#{@path}" at this site.

}, :layout => true, :status => 404 end end end DocumentController.template_root = File.join(File.dirname(__FILE__), '..') begin DocumentController.process_cgi rescue => e CGI.new.out { "#{e.class}: #{e.message}" } end