I'm Parker.

Stay Up-to-date with the Latest GitHub Pages Gem

So you use GitHub Pages and you love that the github-pages gem allows you to keep your local dependencies in sync with the production code. Well, kind of. You seem to have to go check the GitHub Pages Versions page all the time just to make sure you’re in sync. This gets really frustrating.

In their infinite wisdom, the Pages team began publishing a versions.json file right alongside their /versions/ HTML page. This is a huge win for us because now I can do this in my Gemfile:

source 'https://rubygems.org'

require 'json'
require 'open-uri'
versions = JSON.parse(open('https://pages.github.com/versions.json').read)

gem 'github-pages', versions['github-pages']

By grabbing the github-pages version that GitHub Pages is currently running every time your Gemfile is evaluated, you’re good to go. The moment the versions change in production, bundler will start complaining and you’ll know it’s time to upgrade.

Hope this helps those who rely on the GitHub Pages platform for stable website-making. Happy Jekylling!