rmaicle

Programming is an endless loop; it's either you break or exit.

Licensed under a Creative Commons Attribution-ShareAlike 4.0 International License (CC BY-SA).
You are free to copy, reproduce, distribute, display, and make adaptations but you must provide proper attribution. Visit https://creativecommons.org/ or send an email to info@creativecommons.org for more information about the License.

Local GitHub Pages on Windows

Date: 2014-11-05 12:10:19 +0000

I recently started using GitHub Pages. GitHub Pages allows you to get your site up and running in no time. If you’re like me, you can fiddle with the site much more than what other blogging platform allows you. And, this is what I like, create pages and posts using Markdown.

GitHub Pages uses Jekyll. Jekyll is the tool that transforms plain text into static web pages. Installing Jekyll on my machine allows testing of how posts or pages will look before uploading them - nifty!

This post documents the installation of Jekyll on my Windows machine. Here is a reference on how to Run Jekyll on Windows which slightly differs from what I have done.

Download and Install Ruby

I downloaded Ruby 2.1.4 64-bit from the Ruby Installer for Windows site (17MB). The installation takes 48MB of disk space.

Verify that the installation has set the User Executable PATH to point to the Ruby directory.

ruby 2.1.4p265 (2014-10-27 revision 48166) [x64-mingw32]

If, in any case, the command above failed that means the Ruby directory was not set in the User Executable PATH. We will set it manually. Since the Ruby installer sets it in front of all the other User Executable PATHs then we will do the same. We will be using the Ruby directory I used. You need to replace it with the directory where you installed Ruby.

set path=C:\Ruby21-x64\bin;%PATH%;

Note that executing this on the command line is temporary. To make it permanent, you need to set it in the Computer Properties | Advance System Settings | Environment Variables.

Download and Install the Ruby Development Kit

I downloaded the Ruby Development Kit (DevKit) which is a 43MB self-extracting archive file. Installing the DevKit means extracting the contents into a directory like C:\RubyDevKit and will take about 411MB.

If you moved your Ruby directory, you need to edit config.yml in the Ruby Development Kit directory to point to the new Ruby root directory. Also, you need to ‘re-install’ the Ruby Development Kit by executing the following command to override the previous settings.

C:\RubyDevKit>ruby dk.rb install --force

Download and Install Dependencies

From the GitHub Pages Basics site, we need to download and install the Bundler. It is a package manager that makes versioning the Ruby software like Jekyll easier when building GitHub Pages sites locally.

As mentioned, you can use bundle show [gemname] to see where a bundled gem is installed. If an error occurs, correct it and rerun bundle install.

Now, Try It!

Start Jekyll in your local site repository; bundle exec jekyll serve. Open the URL http://localhost:4000/ in your browser.

References

The following links are additional references about GitHub Pages:

  •  github pages
  •  ruby