Quick Notes on Ruby and Jekyll

I feel like I should be writing about Once Upon A Time at this point…

Let’s take a moment to talk about our stack here.

  • Ruby is a dynamic, reflective, object-oriented, general-purpose programming language.
  • Ruby libraries are bundled into gems.
  • Jekyll is a gem that can publish static websites.
  • Bundler lets you list all your dependencies required for the project you’re working on.
  • A Gemfile is a file in which we can list gems for the aforementioned dependencies.

Still with me?

This matters because you can use a Gemfile to define your standard libraries for a Jekyll site. The general idea is that you install Bundler:

$ gem install bundler

Then you make a Gemfile in your Jekyll folder:

source 'https://rubygems.org'

gem 'jekyll', '>= 3.0.0.pre.beta9'
gem 'jekyll-oembed', :require => 'jekyll_oembed'
gem 'jekyll-last-modified-at', :require => 'jekyll-last-modified-at'

What this does is it defines what version of Jekyll I want to use and some of the gems I want to use. For example, if I wanted to add Jekyll Compose to all the users of my Git repository, I would add this:

group :jekyll_plugins do
  gem 'jekyll_compose'
end

Now all they have to do is run bundle after their git pull, and they get the new requirement.