Creating a website using git, markdown and Jekyll in 3 hours.

I want to create content as static pages, but writing pure HTML would be too tedious. Jekyll caught my eye once, as the project was mentioned in Hacker News.

I searched for similar projects (and found several), but nevertheless decided to try Jekyll out.

Result

I was able to install Jekyll and create a base blog skeleton in 3 hours.

Dependencies

These dependencies are purely due my personal preferences.

Ruby Version Manager (RVM)

Why?

I want to use similar workflow as I have with Python (pyenv) and Node.js (nvm).

This means the ability to install multiple ruby versions and gems depending on the project I’m working on without polluting the global system.

Installation

I followed the steps as in explained in https://rvm.io/

$ gpg --keyserver hkp://keys.gnupg.net --recv-keys \
  409B6B1796C275462A1703113804BB82D39DC0E3 \
  7D2BAF1CF37B13E2069D6956105BD0E739499BDB
$ curl -sSL https://get.rvm.io | bash -s stable

Installation automatically updated the ~/.bashrc and ~/.profile files.

I checked the results and everything looked OK, except I wondered why the $HOME/.rvm/scripts/rvm was sourced only in ~/.profile but PATH was updated in both files.

I closed the current terminal and opened a new one; the changes to PATH environment variable came to effect and I could run rvm in the command line.

Ruby v2.4.1

Why?

Well, Jekyll is written in Ruby.

My knowledge and experience on using Ruby is limited; therefore I’m not really familiar with the different Ruby versions and implementations.

So I checked what was available:

$ rvm list known
# MRI Rubies
[ruby-]1.8.6[-p420]
[ruby-]1.8.7[-head] # security released on head
[ruby-]1.9.1[-p431]
[ruby-]1.9.2[-p330]
[ruby-]1.9.3[-p551]
[ruby-]2.0.0[-p648]
[ruby-]2.1[.10]
[ruby-]2.2[.7]
[ruby-]2.3[.4]
[ruby-]2.4[.1]
ruby-head

# for forks use: rvm install ruby-head-<name> --url https://github.com/github/ruby.git --branch 2.2

# JRuby
jruby-1.6[.8]
jruby-1.7[.27]
jruby[-9.1.13.0]
jruby-head

# Rubinius
rbx-1[.4.3]
rbx-2.3[.0]
rbx-2.4[.1]
rbx-2[.5.8]
rbx-3[.84]
rbx-head

# Opal
opal

# Minimalistic ruby implementation - ISO 30170:2012
mruby-1.0.0
mruby-1.1.0
mruby-1.2.0
mruby-1[.3.0]
mruby[-head]

# Ruby Enterprise Edition
ree-1.8.6
ree[-1.8.7][-2012.02]

# Topaz
topaz

# MagLev
maglev[-head]
maglev-1.0.0

# Mac OS X Snow Leopard Or Newer
macruby-0.10
macruby-0.11
macruby[-0.12]
macruby-nightly
macruby-head

# IronRuby
ironruby[-1.1.3]
ironruby-head

Those results led me to do some googling and I learned that Ruby MRI seems to be the ‘reference implementation’, so let’s roll with that.

Then I checked https://www.ruby-lang.org/en/downloads/releases/ to learn more about the different MRI versions. Well, nothing indicated why I shouldn’t install the latest available version in RVM, so I chose 2.4.1.

Installation

$ rvm install 2.4.1
Searching for binary rubies, this might take some time.
No binary rubies available for: debian/9/x86_64/ruby-2.4.1.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for debian.
Installing requirements for debian.
Updating system
askolsam password required for 'apt-get --quiet --yes update':
...

At this stage I entered my password and let RVM do it’s thing. Few minutes later the process finished successfully.

I tried to test the installed Ruby:

$ rvm use ruby-2.4.1

RVM is not a function, selecting rubies with 'rvm use ...' will not work.

You need to change your terminal emulator preferences to allow login shell.
Sometimes it is required to use `/bin/bash --login` as the command.
Please visit https://rvm.io/integration/gnome-terminal/ for an example.

Ok, this is clearly a symptom of the file $HOME/.rvm/scripts/rvm not being sourced, just like I wondered in the RVM installation phase.

For testing purposes I just manually sourced the file:

$ source $HOME/.rvm/scripts/rvm

and tried again:

$ rvm use ruby-2.4.1
Using /home/askolsam/.rvm/gems/ruby-2.4.1

$ which ruby
/home/askolsam/.rvm/rubies/ruby-2.4.1/bin/ruby

Installation succesful.

Update 2018-06-24

I should/could have read the URL mentioned in the error message above.

Create a RVM project files to my git repo

I just followed the RVM best practices guide.

$ cd ~src/webpages
$ rvm use ruby-2.4.1
$ rvm gemset create jekyll
ruby-2.4.1 - #gemset created /home/askolsam/.rvm/gems/ruby-2.4.1@jekyll
ruby-2.4.1 - #generating jekyll wrappers........
$ rvm --ruby-version use 2.4.1@jekyll

Test that settings are applied:

$ cd ~
$ rvm use system
Now using system ruby.

$ which ruby
/usr/bin/ruby

$ rvm gemset list

gemsets for system (found in /home/askolsam/.rvm/gems/system)
=> (default)
   *

$ cd ~src/webpages
$ which ruby
/home/askolsam/.rvm/rubies/ruby-2.4.1/bin/ruby

$ rvm gemset list

gemsets for ruby-2.4.1 (found in /home/askolsam/.rvm/gems/ruby-2.4.1)
   (default)
   global
=> jekyll

Looks ok.

Installing Jekyll

As instructed in Jekyll quick-start guide, I ran:

$ cd ~src/webpages
$ gem install jekyll
Fetching: public_suffix-3.0.2.gem (100%)
Successfully installed public_suffix-3.0.2
Fetching: addressable-2.5.2.gem (100%)
Successfully installed addressable-2.5.2
Fetching: colorator-1.1.0.gem (100%)
Successfully installed colorator-1.1.0
Fetching: http_parser.rb-0.6.0.gem (100%)
Building native extensions.  This could take a while...
Successfully installed http_parser.rb-0.6.0
Fetching: eventmachine-1.2.5.gem (100%)
Building native extensions.  This could take a while...
Successfully installed eventmachine-1.2.5
Fetching: em-websocket-0.5.1.gem (100%)
Successfully installed em-websocket-0.5.1
Fetching: concurrent-ruby-1.0.5.gem (100%)
Successfully installed concurrent-ruby-1.0.5
Fetching: i18n-0.9.5.gem (100%)
Successfully installed i18n-0.9.5
Fetching: rb-fsevent-0.10.3.gem (100%)
Successfully installed rb-fsevent-0.10.3
Fetching: ffi-1.9.23.gem (100%)
Building native extensions.  This could take a while...
Successfully installed ffi-1.9.23
Fetching: rb-inotify-0.9.10.gem (100%)
Successfully installed rb-inotify-0.9.10
Fetching: sass-listen-4.0.0.gem (100%)
Successfully installed sass-listen-4.0.0
Fetching: sass-3.5.6.gem (100%)
Successfully installed sass-3.5.6
Fetching: jekyll-sass-converter-1.5.2.gem (100%)
Successfully installed jekyll-sass-converter-1.5.2
Fetching: ruby_dep-1.5.0.gem (100%)
Successfully installed ruby_dep-1.5.0
Fetching: listen-3.1.5.gem (100%)
Successfully installed listen-3.1.5
Fetching: jekyll-watch-2.0.0.gem (100%)
Successfully installed jekyll-watch-2.0.0
Fetching: kramdown-1.16.2.gem (100%)
Successfully installed kramdown-1.16.2
Fetching: liquid-4.0.0.gem (100%)
Successfully installed liquid-4.0.0
Fetching: mercenary-0.3.6.gem (100%)
Successfully installed mercenary-0.3.6
Fetching: forwardable-extended-2.6.0.gem (100%)
Successfully installed forwardable-extended-2.6.0
Fetching: pathutil-0.16.1.gem (100%)
Successfully installed pathutil-0.16.1
Fetching: rouge-3.1.1.gem (100%)
Successfully installed rouge-3.1.1
Fetching: safe_yaml-1.0.4.gem (100%)
Successfully installed safe_yaml-1.0.4
Fetching: jekyll-3.7.3.gem (100%)
Successfully installed jekyll-3.7.3
Parsing documentation for public_suffix-3.0.2
Installing ri documentation for public_suffix-3.0.2
Parsing documentation for addressable-2.5.2
Installing ri documentation for addressable-2.5.2
Parsing documentation for colorator-1.1.0
Installing ri documentation for colorator-1.1.0
Parsing documentation for http_parser.rb-0.6.0
Installing ri documentation for http_parser.rb-0.6.0
Parsing documentation for eventmachine-1.2.5
Installing ri documentation for eventmachine-1.2.5
Parsing documentation for em-websocket-0.5.1
Installing ri documentation for em-websocket-0.5.1
Parsing documentation for concurrent-ruby-1.0.5
Installing ri documentation for concurrent-ruby-1.0.5
Parsing documentation for i18n-0.9.5
Installing ri documentation for i18n-0.9.5
Parsing documentation for rb-fsevent-0.10.3
Installing ri documentation for rb-fsevent-0.10.3
Parsing documentation for ffi-1.9.23
Installing ri documentation for ffi-1.9.23
Parsing documentation for rb-inotify-0.9.10
Installing ri documentation for rb-inotify-0.9.10
Parsing documentation for sass-listen-4.0.0
Installing ri documentation for sass-listen-4.0.0
Parsing documentation for sass-3.5.6
Installing ri documentation for sass-3.5.6
Parsing documentation for jekyll-sass-converter-1.5.2
Installing ri documentation for jekyll-sass-converter-1.5.2
Parsing documentation for ruby_dep-1.5.0
Installing ri documentation for ruby_dep-1.5.0
Parsing documentation for listen-3.1.5
Installing ri documentation for listen-3.1.5
Parsing documentation for jekyll-watch-2.0.0
Installing ri documentation for jekyll-watch-2.0.0
Parsing documentation for kramdown-1.16.2
Installing ri documentation for kramdown-1.16.2
Parsing documentation for liquid-4.0.0
Installing ri documentation for liquid-4.0.0
Parsing documentation for mercenary-0.3.6
Installing ri documentation for mercenary-0.3.6
Parsing documentation for forwardable-extended-2.6.0
Installing ri documentation for forwardable-extended-2.6.0
Parsing documentation for pathutil-0.16.1
Installing ri documentation for pathutil-0.16.1
Parsing documentation for rouge-3.1.1
Installing ri documentation for rouge-3.1.1
Parsing documentation for safe_yaml-1.0.4
Installing ri documentation for safe_yaml-1.0.4
Parsing documentation for jekyll-3.7.3
Installing ri documentation for jekyll-3.7.3
Done installing documentation for public_suffix, addressable, colorator, http_parser.rb,
eventmachine, em-websocket, concurrent-ruby, i18n, rb-fsevent, ffi, rb-inotify, sass-listen,
sass, jekyll-sass-converter, ruby_dep, listen, jekyll-watch, kramdown, liquid, mercenary,
forwardable-extended, pathutil, rouge, safe_yaml, jekyll after 33 seconds
25 gems installed

$ gem install bundler
Fetching: bundler-1.16.1.gem (100%)
Successfully installed bundler-1.16.1
Parsing documentation for bundler-1.16.1
Installing ri documentation for bundler-1.16.1
Done installing documentation for bundler after 4 seconds
1 gem installed

“Everything went better than expected”.

Creating the blog skeleton

As instructed in Jekyll quick-start guide, I ran:

$ cd ~src/webpages
$ jekyll new blog
Running bundle install in /home/askolsam/src/webpages/blog...
  Bundler: The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.
  Bundler: Fetching gem metadata from https://rubygems.org/...........
  Bundler: Fetching gem metadata from https://rubygems.org/.
  Bundler: Resolving dependencies...
  Bundler: Using public_suffix 3.0.2
  Bundler: Using addressable 2.5.2
  Bundler: Using bundler 1.16.1
  Bundler: Using colorator 1.1.0
  Bundler: Using concurrent-ruby 1.0.5
  Bundler: Using eventmachine 1.2.5
  Bundler: Using http_parser.rb 0.6.0
  Bundler: Using em-websocket 0.5.1
  Bundler: Using ffi 1.9.23
  Bundler: Using forwardable-extended 2.6.0
  Bundler: Using i18n 0.9.5
  Bundler: Using rb-fsevent 0.10.3
  Bundler: Using rb-inotify 0.9.10
  Bundler: Using sass-listen 4.0.0
  Bundler: Using sass 3.5.6
  Bundler: Using jekyll-sass-converter 1.5.2
  Bundler: Using ruby_dep 1.5.0
  Bundler: Using listen 3.1.5
  Bundler: Using jekyll-watch 2.0.0
  Bundler: Using kramdown 1.16.2
  Bundler: Using liquid 4.0.0
  Bundler: Using mercenary 0.3.6
  Bundler: Using pathutil 0.16.1
  Bundler: Using rouge 3.1.1
  Bundler: Using safe_yaml 1.0.4
  Bundler: Using jekyll 3.7.3
  Bundler: Fetching jekyll-feed 0.9.3
  Bundler: Installing jekyll-feed 0.9.3
  Bundler: Fetching jekyll-seo-tag 2.4.0
  Bundler: Installing jekyll-seo-tag 2.4.0
  Bundler: Fetching minima 2.4.0
  Bundler: Installing minima 2.4.0
  Bundler: Bundle complete! 4 Gemfile dependencies, 29 gems now installed.
  Bundler: Use `bundle info [gemname]` to see where a bundled gem is installed.
New jekyll site installed in /home/askolsam/src/webpages/blog.

Previewing the blog

As instructed in Jekyll quick-start guide, I ran:

$ cd ~/src/webpages/blog
$ bundler exec jekyll serve
configuration file: /home/askolsam/src/webpages/blog/_config.yml
            Source: /home/askolsam/src/webpages/blog
       Destination: /home/askolsam/src/webpages/blog/_site
 Incremental build: disabled. Enable with --incremental
      Generating...
                    done in 0.368 seconds.
 Auto-regeneration: enabled for /home/askolsam/src/webpages/blog'
    Server address: http://127.0.0.1:4000/blog/
  Server running... press ctrl-c to stop.

I opened http://127.0.0.1:4000/blog/ with my browser and very minimalistic example content was visible.

Mission accomplished.