Skip to content
This repository has been archived by the owner on Jun 21, 2022. It is now read-only.

Using Ruby

Scott Numamoto edited this page Apr 20, 2021 · 2 revisions

Ruby Versions

There are multiple versions of Ruby. Macs come preintalled with Ruby. To ensure that developers are using the same version of Ruby, we declare the version of Ruby.

Developers should install rbenv to manage multiple versions of Ruby on their machine.

Find the instructions to update your shell

rbenv init

Install the website's version of Ruby

cd website

# Install the current version
rbenv install $(cat .ruby-version)
rbenv rehash

Ruby Dependencies

The website uses the Jekyll Gem / library. We'd like to ensure that all developers use the same version of the library and its dependencies.

We declare what libraries and their versions we'd like to use in the Gemfile. We then use Bundler to create the Gemfile.lock that records the exact versions of all libraries.

Bundler allows us to give each project its own set of libraries with specific versions. This is especially important if you have multiple Ruby projects.

Drawing from Python land, Bundler is similar to virutalenv or pipenv.

# Confirm that we're using the correct version of Ruby
cat .ruby-version
rbenv version

# Install bundler for this version of Ruby
gem install bundler

# Install this projects dependencies
bundle install

# Use this projects dependencies
bundle exec jekyll -v