Colophon

Art | Bicycling | Hacks | Making Stuff | Music | Wirehead
Home | Mail
WireWorld > Wirehead > Colophon

I love the phrase "Eating your own dogfood" It's crude and nasty and actually quite descriptive. See, I'm working on this fairly elaborate piece of software called Rm. I can picture a huge structure that could serve a large high-traffic site with all kinds of neat features built with Rm. But I don't need to do that right away, I need something that's possible for me to write in my spare time.

There are two kinds of hackers. One kind hacks a piece of software together quickly that barely works, knowing that they'll be able to fix it if it breaks. This kind of hacker writes a bogging engine in 1200 lines of Perl.

I'm the other kind of hacker. I take a little longer, design something that's conceptually pure and capable of many things, and figures out how to implement a reasonable chunk of that functionality fairly quickly. It works better at the office than it does at home, mind you, because I don't work on something more interesting and not touch something for a year.

The inspiration was reading about the ltree datatype for PostgreSQL and the table inheritance. I could visualize how you could use that to store a whole site as a set of tables with inheritance and create something that was flexibly structured.

Rm is a framework written in Ruby that creates an object-oriented database on top of PostgreSQL and organizes it into a hierarchical URL structure. So, each "directory" on the site (e.g. "/wh/colophon/") corresponds to a record in a PostgreSQL table with a primary key of "wh.colophon". You can specify actions in the URL to edit, delete, or view alternate representations of things. And different objects have different types (this one's type is "rm_page") that a whole bunch of scaffolding code serializes and mediates. Each type has its own database table that inherits from a root table and its own corresponding Ruby class that inherits from a root base class. Adding new types is easy. I hacked up a new page type for small pieces of code in a matter of minutes.

The templates live as XML files that a templating engine traverses to replace commands with their result. Any static pages that you request are cached because the templating code is fairly slow at the moment.

There's an administration interface behind the scenes to create and edit pages. My cellphone has a good enough web browser to let me edit the content of the site from my cell or from a normal computer.

I use apache with mod_ruby to serve up the pages and a mod_rewrite rule to convert from the supplied pathname to call a single ruby function to generate the resulting page.

For more information, Check out the Rm page...

Copyright 2007, Ken Wronkiewicz
Version 4.0
Last Updated: 2007-11-01 12:53AM
Posted: 2002-02-15 12:00AM