Jekyll Forman Guard Bundler
Published on May 13, 2012 by Vincent Demeester.
Introduction
This post is a quick “How did I setup my Jekyll environnement ?”. We are going all the tools that are quite awesome in Ruby.
Goal
Bundler
Bundler let us run bundle install
to get all Ruby Gems we will need ;
It use a file name Gemfile
. The gems we need are simple : jekyll
,
guard
and some Guard extensions.
source "http://rubygems.org" gem 'jekyll' gem 'guard' gem 'guard-jekyll2' gem 'guard-shell' gem 'guard-bundler'
Guard
Guard is a command line tool to easily handle events on file system modifications.
Guard will be watching file we told him and run action in consequence ;
The file is name Guardfile
.
guard 'jekyll2' do watch %r{.*} end guard :bundler do watch('Gemfile') end # vim:filetype=ruby
Foreman
Finally, foreman will let us declare our processes and will handle the
start, forward the output and handle the shutdown. It can then export
its configuration into more production-ready file (init
, upstard
,
…) ; It uses a file named Procfile
.
We will tell foreman to run :
- The jekyll build-in server :
jekyll --server
- Guard, to handle file changes in background.
web: bundle exec jekyll --server guard: bundle exec guard
And that’s all folk. Now, you just need to run foreman in the Jekyll-powered directory and edit your files.