WhatCodeCraves

FlacoBlog

I love to eat. What I eat depends a lot on the situation. Somedays it's worthwhile to go out to a nice restaurant with friends. Other times, it's more comfortable to cook a simple meal. Then there are those times of uncontrollable hunger, times when that 2-minute hot pocket suddenly become your best friend.

FlacoBlog is like the hot pocket of content management systems. It is a ruby script that takes a bunch of text files, translates them with Markdown, lays out the resulting html with ERB templates. It's quick and easy to setup, use, and maintain. But it's not for everyone. It's catered to terminal nerds and unix geeks. There's no web interface. There's no bloated list of dependencies. When you look at the source, you might laugh at how simple it really is. Just bring your favorite text editor and write your blog entries in beautiful plain text.

Goals

I learned a lot about my usage habits from running the other blog systems. I kept my habits in while I wrote FlacoBlog. Here are some of the core design goals.

Installation

The directory this README is in is the blog root. Before you can use FlacoBlog, you will need Ruby, and rdiscount. If you don't have rdisount, you can install with:

sudo gem install rdiscount

To publish the blog, simply type:

ruby flaco.rb

The resulting blog will be put in 'index.html'

How it Works

The core of FlacoBlog is actually a few utility functions that help you find files you want to publish (ingredients), and map arbitrary ruby functions (kitchen_appliances) on those files. Think of it as a small wrapper around GNU Find, and a declarative mini-language for describing how to work on found files. If you wanted to replace Markdown with Textile, simply use a different 'kitchen_appliance' when you're publishing. The same applies if you wanted to use templating system other than ERB.

Here's the declaration for a sample ingredient:

ingredient(:backup_files, :regex => '.*~')

Here's the declaration for a kitchen appliance:

kitchen_appliance(:rm) { |ingredients|
  ingredients.each { |i| File.delete(i) }
}

Once you declare all your ingredients, you can write a 'recipe' by applying kitchen_appliances to ingredients with the cook method:

cook(:backup_files, :with => :rm)

These methods allow you to describe files you commonly work with, and also actions you commonly perform. Check out the bottom of the source for flaco.rb, and you'll see the actions FlacoBlog takes to stitch together a blog.

Configuration

See flaco.yml.

Hacking

FlacoBlog gives you a working blog work of the box, but it's not hard to add new features if you want them. Look through the source to write your own custom ingredients and recipes. If you write something cool, write me a comment, or send me a pull request.