juretta.com

Goodby Rails, kind of...

Tags: Rails, Ruby, Jekyll, git

I started this blog about 4 years ago using a custom built Rails blog engine using Rails 0.8. A Rails based blog engine wasn't around at that time and I wanted to build something using Rails anyway.

Having a custom built blog engine has its benefits and drawbacks. The rather basic administration interface was a pain to use and running two Mongrel instances for a nearly static website seemed to be a misallocation of ressources anyway.

So instead of switching to another full-fledged blog engine I switched to using Jekyll to generate a static version of the blog.

Tom Preston-Werner (the author of Jekyll) writes about his reasons for creating Jekkyl in Blogging Like a Hacker:

I was tired of complicated blogging engines like WordPress and Mephisto. I wanted to write great posts, not style a zillion template pages, moderate comments all day long, and constantly lag behind the latest software release.

Jekyll is the complete opposite, it is a:

[...] simple, blog aware, static site generator. It takes a template directory (representing the raw form of a website), runs it through Textile and Liquid converters, and spits out a complete, static website suitable for serving with Apache or your favorite web server.

With a basic directory layout and a simple configuration file creating a static copy of your blog is merely running the jekyll command in your blog directory.

stefan@macbook-pro:~/webs/juretta.com/www [0]$ tree -L 3
.
|-- Rakefile
|-- _config.yml
|-- site
|   |-- 404.html
|   |-- _includes
|   |   `-- entry-preview.html
|   |-- _layouts
|   |   |-- default.html
|   |   `-- post.html
|   |-- _posts
|   |   |-- 2008-11-11-hudson_test_drive_part_1_rails.html
|   |   |-- 2008-12-11-hudson_at_wellrailed.html
|   |   |-- 2009-05-24-activemq-jms-stomp.markdown
|   |   `-- 2009-05-29-goodbye-rails.markdown
|   |-- about
|   |   `-- index.html
|   |-- atom.xml
|   |-- favicon.ico
|   |-- images
|   |-- index.html
|   |-- javascripts
|   |-- rss.xml
|   |-- sitemap.xml
|   `-- stylesheets
`-- web

Running jekyll in this directory will copy all the static files in site into web and will transform your content files (HTML, Markdown, Textile based) applying a series of layout files (Read more on the Jekyll Wiki pages: Usage).

Running jekyll --server will transform the files and fires up a local WEBrick server running on http://localhost:4000.

stefan@macbook-pro:~/webs/juretta.com/www (master) [0]$ rake server
(in /Users/stefan/webs/juretta.com/www)
juicer merge --force --document-root ./site ./site/stylesheets/base.css
Produced site/stylesheets/base.min.css from
  site/stylesheets/undohtml.css
  site/stylesheets/screen.css
  site/stylesheets/form.css
  site/stylesheets/syntax.css
  site/stylesheets/base.css
jekyll --server
Configuration from ./_config.yml
Building site: site -> web
Successfully generated site: site -> web
[2009-05-29 17:49:10] INFO  WEBrick 1.3.1
[2009-05-29 17:49:10] INFO  ruby 1.8.6 (2007-09-24) [i686-darwin9.2.0]
[2009-05-29 17:49:10] INFO  WEBrick::HTTPServer#start: pid=7634 port=4000

Throw in some juicer goodness and a nice git post-receive hook and your new post is only a single git push away.


About

This is the defunct blog of Stefan Saasen.