Ordo Acerbus was the first web application I wrote when I started learning Rails. It was a home-grown CMS of sorts. I think the version of Rails was 1.1 at the time, and a few things have changed since then. Unfortunately since I didn’t know about future-proofing it then, and Rails has gone through a few versions, it now has issues.
I tried to log in to write a new page the other day, and ran into some application errors. Faced with the prospect of some awkward bug hunting and fixing just to get it to work like it used to, I did what every self-respecting programmer longs to do1 and decided to do a rewrite.
Only when I reinvent the wheel, I’m going to make it
I set myself a few goals to keep this project under control:
- No database, only files. It’s only a website after all.
- Which means I don’t need some interface to edit the pages – I can just shell into the server and edit them in a text editor. Simple, see? That also avoids needing logins and passwords and that sort of thing.
- But I don’t want to edit a bunch of HTML, so the pages will use Markdown. Actually, the old version used Markdown, so this means I just have to dump out the content as is2.
- For similar reasons, the site layout will use ERB (rhtml) because then I just have to tweak the old template.
- The code will be in Ruby (of course) and will fit in a single file, to show how simple it is. And I’ll rely on Rack because Dreamhost provides it in a simple way.
My work in progress dev site is starting to look close to the old site. Shame I forgot about the complexity of the left-hand menu when I made up my simple goals.
So now I’m trying to figure out how to build the menu without reading every file on every page request, but still have it update when I edit a page. Hmm.
1 And should not do. Ever.
2 Actually it uses a bastard RedCloth 3.0 dialect of Markdown + Textile + my own custom tag extensions, but since I just had to copy and include a library file from the old system to get that, it doesn’t count.