Skip to content

Ruby Gems

Philip Colmer edited this page Jul 1, 2019 · 2 revisions

Jekyll relies heavily on gems to extend the functionality and look of sites generated with the tool. In order to provide resiliency against gems used by our sites being removed from rubygems.org or a lack of access to the site, the Jekyll Build Container now includes all of the gems being used by each site.

The "top level" gems explicitly required by each site are included for a specific version number to increase the certainty of consistently building a site with the same gems. However, some of the "required" gems do not have strict version numbers. For example, the addressable gem requires public_suffix but is happy for any version >= 2.0.2 and < 4.0. As a result of this flexibility, we no longer incorporate Gemfile.lock into web site repos and, indeed, the site building script will remove any Gemfile.lock because, otherwise, there is a risk that the container has different versions from those specified in the lock file and that would cause the build to abort.

Each web site repo still needs a Gemfile because the bundle exec command is used to start jekyll and bundle needs the Gemfile to figure out which gems are required.

Contributing

If you are contributing to a web site and you need a new gem or a higher version of a gem, please follow these steps:

  1. Fork this repository
  2. If you need a new gem, add it (along with the required version) to the section near the end where the gems are installed.
  3. If you need a higher version, duplicate the existing line that installs the gem and change the version number appropriately. Other sites may still need the older version. Only replace the line completely if the higher version fixes a security issue.
  4. Build the container using the instructions in the README, remembering to use your own tag for testing.
  5. Test against the site you are contributing to.
  6. When you are happy that everything is correct, create a Pull Request for this repository. After it has been approved, Linaro's build server will build a new version of the container. You can then proceed with raising a Pull Request for the web site repository that you are contributing to.

Please note that if you make changes to a web site repository that includes gem changes and you do not follow the above steps, your web site Pull Request may fail when the test build is carried out.