Last month I said I’d make a comment system for ongoing, and I got lots of good advice. Several of the people who wrote suggested I consider Camping, so I decided to give that a try, and started today.
Step 1, recent Ruby. Download, ./configure
, make
,
sudo make
install
, OK. Hmm, if Ruby’s there, why not Gems? Download, sudo
ruby setup.rb
, OK. Now it wants SQLite...
Hrmph, I’m using Camping because I don’t want to have one of those filthy database thingies in the loop. I know lots of perfectly decent and honorable people connect databases to websites at runtime, and many of them go on to have happy and useful lives, in fact some of my best friends use runtime databases (but my new daughter isn’t going to marry one of them).
But I digress.
Sigh, Fink doesn’t seem to know about SQLite3. OK, go get ’er.
Download. Make a
separate directory to build in? Well, then:
../sqlite-3.3.6/configure
, make
, sudo make
install
, OK.
Now SWIG. Dammit, this is supposed to be about coding, not drinking.
Download, ./configure
, make
, sudo make
install
, OK.
My laptop has now developed a tilt, one SWIG too many? Or maybe that’s the side of the disk
where /usr/local
lives.
OK, now for the last software appetizer: sudo gem install sqlite3-ruby
Huh, gem is asking me whether I want 1.1.0 or 1.0.1, and whether I
want a “ruby” or “mswin32” version. Hey Gem, if you need to ask there’s
nothing I can say that will help you.
We’re there! sudo gem install camping --source
http://code.whytheluckystiff.net/
Hmph, it puked some error message about ActiveRecord documentation generation,
right, they complained about that on ruby-talk and apparently it can be
ignored.
Now, how do we get started... Camping seems to have two or three different
home pages and a Wiki and not that much by way of “First Steps”. Well, let’s
just poke around in the installation directory: view README
.
Hah, now we’re cooking. Anyone else considering going camping, that’s where
you start.
Does it run? camping blog.rb
It’s creating tables
(grrr, I spit on your tables), it’s running WEBrick on port 3301,
and, hey there it is, I can write little blog entries! (Uh, “Submit Query”?
How last-millenium.)
All right, let’s wrangle some code. Hey, Emacs’ ruby-mode seems very decent.
Now apparently I need to understand
something called
Markaby. Um... it’s
trying to make Ruby look like markup. Or is it trying to make markup look like
Ruby? I’m wondering why this is a good idea. So, I replicate the fragment
and it doesn’t work because it needs stylesheet_link_tag
, which
is apparently part of ActionView which is part of Rails. But I do need a
stylesheet. So how do I do a link
element? The
docs don’t seem to mention the
term “link”... hold on, the text for method_missing
is suggestive, suppose I just use
html do
head {
title 'ongoing · comments'
link \
:rel => 'stylesheet',
:href => 'http://www.tbray.org/ongoing/serif.css'
}
(Emacs is refusing to indent continuation lines, I wonder why?) And it produces
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
<title>ongoing · comments</title>
<link rel="stylesheet" href="http://www.tbray.org/ongoing/serif.css"/>
</head>
Yowie. Uh, where’d that DOCTYPE
and meta
come
from?
Maybe I don’t like text/html
?
And maybe I’m not an XHTML-transitional transsexual Transylvanian?
File for revisit.
At one point it was escaping the &
in
½
and at another it wasn’t. Keith,
stomp that roach!
Checkpoint ·
Yep, Camping does seem to provide something not entirely unlike an
application framework in a little file, provided of course you download and
install several acres of infrastructure.
It’ll be on Debian in production, I’m thinking
apt-get install everything-you-need-for-Camping
Sorry, lost my head there.
I think I can use this.
Um, what is this WEBrick and this Mongrel of which you speak? ongoing is and will remain served by Apache dammit and I don’t want any more Web servers facing the big wild Internet, thankyouverymuch. Presumably there must be a way to connect A to C; push it on the stack.
Also, I have firm and fixed and really unreasonably inflexible ideas about
URIs, for example, the fact that the serif.css
URI above is
absolute is a huge fucking stinky bug. I will wrestle this
infrastructure to the ground and if it cavils at my orders about What The
URI Will Be it will end up saying “May I have another, sir?” pretty damn
quick.
I think that this will go quite quickly. And that it won’t use SQLite.