Using Node.js to convert Drupal to Jekkyl

blog

I’ve gone and revamped my blog again.

The current new hotness has been Jekkyl of late, ever since GitHub came out with it’s Pages feature. My first awareness of it was around September 2011 when DevelopmentSeed converted their .org page to Jekkly and wrote about it. I started playing with it almost immediately when I had downtime during Lullabot’s Do it with Drupal conference. Sacreligious? Whatever, it was something new to learn.

Then quite recently Walkah.net moved to Jekkyl and renewed my interest when he released the Ruby script he used to convert his simple Drupal blog into YAML for use with Jekkly. That looked interesting so I put it in my backlog.

Shortly after, I started getting some flak from @mikl for not paying attention to my Drupal.org issue queue for the Flag Friend module and as I interacted with and him, found that he was using Octopress for his personal blog. Octopress is a quick way to get started using Jekkly, and I like quick.

So I put these two sources of inspiration together and it gave me reason to revisit Walkah’s Ruby script. After a few hours of trying to get the MySQL Ruby Gem working with the version of MySQL I have that comes with MAMP, I gave up and decided to just rewrite the script into Node.js, which I’ve been trying to learn more about lately.

The end result is all of my posts from JeradBitner.com converted into YAML format for use with the Octopress system which uses Jekkyl to generate your pages and can be convieniently hooked up to GitHub Pages in order to quickly create content with a few simple commands. (Whew! Try saying that to your wife without sounding bat-shit crazy!)

$> rake new_post['Title of your post']   Then write your post of course.
$> rake generate   Which runs Jekkly and converts all of your YAML to HTML and puts the files in the correct place.
$> rake preview   This starts up a local server so you can see your new post at localhost:4000.
$> rake deploy   Which commits the generated files to your GitHub repository and pushes them.