DevOps Engineer. Solutions Architect

Blog 0: Understanding the Jekyll Gemfile

Jekyll, a popular simple static site generator, is commonly used by developers or bloggers who want a quick and easy solution to create posts on their discoveries. If you’d like to host your very own Jekyll site on GitHub Pages, please check out this article.

Once you install Jekyll, you’ll notice a newly generated Gemfile inside your directory. Jekyll is a Gem, Ruby-based code, that can be utilized in Ruby projects. There are a variety of Gems available with their own unique functionality whether it’d be interacting with APIs or converting a Ruby object to JSON.

Inside the Gemfile is a list of gems used by your website. Here is a snippet of gems being used in my Jekyll site:

Imgur

You’ll notice the specific syntax being used to determine which version of the gem you want to install and which group it affects.

Those familiar with PHP’s Composer packet management, can see the similarities between a Gemfile and a composer.json file. They are both files that contain user declared packages and dependencies necessary for the project. Gemfile’s are commonly managed by Bundler, a gem that manages gem dependencies. Similar to Composer, you’ll need to run an installation command bundle install inside the directory of your Gemfile.

Periodically as you add additional gems to enhance your Jekyll site, you’ll might need to update packages to the most recent released version. Run bundle update to search and install and package updates.

Other Bundler Commands

bundle init - Create a new Gemfile
bundle exec - Execute a script in the current bundle
bundle help - Display detailed help for each subcommand

Helpful Links:

Bundler

Bundler for Mac