Skip to content

Instantly share code, notes, and snippets.

@BradKnowles
Last active February 6, 2016 16:56
Show Gist options
  • Save BradKnowles/da71a74c829917cff59f to your computer and use it in GitHub Desktop.
Save BradKnowles/da71a74c829917cff59f to your computer and use it in GitHub Desktop.
Setting up Ruby, GitHub Pages and Jekyll

Installing the tools

Ruby needs installed first. See https://gist.github.com/BradKnowles/da71a74c829917cff59f#file-ruby-md. These notes came from https://help.github.com/articles/using-jekyll-with-pages/

Install bundler

gem install bundler

Install github-pages

Create and navigate to the directory holding the website

mkdir ~/site
cd ~/site

Create the Gemfile in the root directory ~/site

echo "source 'https://rubygems.org'" > Gemfile
echo "gem 'github-pages'" >> Gemfile

>> appends to Gemfile

Now that bundler is installed and the Gemfile is created, install github-pages. github-pages includes Jekyll and all the necessary dependencies. Once this finishes, Jekyll can be used to create the site scaffold.

bundle install

Using Jekyll

While still inside ~/site, create a new Jekyll site

jekyll new . --force

--force is required because ~/site is not empty. It contains Gemfile and Gemfile.lock

This creates Jekyll's folder structure and site defaults. The site is ready to serve and customize.

bundle exec jekyll serve

Navigate to http://127.0.0.1:4000/ to see the new site!

Installing the tools

Install Ruby using "ruby-install" from https://github.com/postmodern/ruby-install

cd ~/Downloads
wget -O ruby-install-0.6.0.tar.gz https://github.com/postmodern/ruby-install/archive/v0.6.0.tar.gz
tar -xzvf ruby-install-0.6.0.tar.gz
cd ruby-install-0.6.0/
sudo make install

Install chruby to manage and switch between multiple Rubies, from https://github.com/postmodern/chruby

cd ~/Downloads
wget -O chruby-0.3.9.tar.gz https://github.com/postmodern/chruby/archive/v0.3.9.tar.gz
tar -xzvf chruby-0.3.9.tar.gz
cd chruby-0.3.9/
sudo make install

Don't forget to source chruby in either .bashrc or .bash_profile

source /usr/local/share/chruby/chruby.sh

Here's a link explaining the differences http://www.joshstaiger.org/archives/2005/07/bash_profile_vs.html

Once the terminal is restarted, the tools will be available to use.

Installing Ruby

Now that the tools are installed, install Ruby.

ruby-install --cleanup ruby

--cleanup empties the ~/src directory when the install is finished. ruby tells ruby-install to get the latest version of ruby

Add chruby ruby-2.3-0 to .bashrc to load ruby automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment