I liked the idea of being able to post to LiveJournal directly from BBEdit. I find that any post that I’m doing that’s of significant length, and sometimes even short ones, is easier to compose in a real text editor and write with Markdown. This leaves me the short but kind of Rube Goldberg-esque task of converting the file to HTML and posting it to LJ in another program. Why not have it all happen within BBEdit? Hence my experiment yesterday, which had the minor problem of using a qualitatively sucky command line client for the back end.
So naturally, I figured, why not write my own? And, hey, I could use it as an opportunity to actually write a mildly functional Ruby program. And while I’m at it, why not set it up so it can do the translation from Markdown to HTML for me?
After a few false starts, I have a program which seems to actually do that. It’s pretty dirt-simple–a few configuration options saved in
.ljpostrc, and metadata set in a way which looks like email (i.e., at the top of this message I have lines that start with ‘headers’ for subject, mood and music). It’s not terribly elegant and I suspect it fails to do things The Ruby Way™, but it does nearly everything I want it to. (All it really needs to be as feature complete as a post-only client can get is handling post security; right now it only knows ‘public’ and ‘private.’ Friends group handling is unnecessarily wonky in the LJ protocol.) And, I’ve tried to write it in a way where it’d be useful for anyone else who, for some ungodly reason, wanted to have a CLI post-only LiveJournal client.
I can see why people like Ruby. For the most part it’s very straightforward; once you’ve learned the language basics, a guess at what the syntax for something “should” be will usually be correct, which neither PHP nor Perl can claim with a straight face.
What am I going to do with Ruby other than stupid pet tricks? I don’t know, yet. It’s been good at keeping my mind off other angsty things today, though, so that’s certainly something…