Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 12 additions & 16 deletions .devcontainer/post-create.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -euo pipefail

for cmd in curl git sed; do
for cmd in git tr; do
if ! command -v "${cmd}" >/dev/null 2>&1; then
echo "${cmd} is required for .devcontainer/post-create.sh"
exit 1
Expand Down Expand Up @@ -45,21 +45,17 @@ fi
echo "Initializing/updating git submodules"
git submodule update --init --recursive

versions_json="$(curl -fsSL https://pages.github.com/versions.json)" || {
echo "Failed to fetch https://pages.github.com/versions.json"
ruby_version_file=".ruby-version"
if [[ ! -f "${ruby_version_file}" ]]; then
echo "Could not find ${ruby_version_file}"
exit 1
}

pages_ruby_version="$(
printf '%s' "${versions_json}" |
sed -n 's/.*"ruby"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' |
head -n 1
)"
fi

echo "GitHub Pages Ruby version: ${pages_ruby_version}"
repo_ruby_version="$(tr -d '[:space:]' < "${ruby_version_file}")"
echo "Repository Ruby version: ${repo_ruby_version}"

if [[ -z "${pages_ruby_version}" ]]; then
echo "Could not determine Ruby version from https://pages.github.com/versions.json"
if [[ -z "${repo_ruby_version}" ]]; then
echo "Could not determine Ruby version from ${ruby_version_file}"
exit 1
fi

Expand All @@ -75,8 +71,8 @@ fi
export PATH="$HOME/.rbenv/bin:$HOME/.rbenv/shims:$PATH"
eval "$(rbenv init - bash)"

rbenv install -s "${pages_ruby_version}"
rbenv global "${pages_ruby_version}"
rbenv install -s "${repo_ruby_version}"
rbenv global "${repo_ruby_version}"
rbenv rehash

for profile in "$HOME/.bashrc" "$HOME/.zshrc"; do
Expand All @@ -94,4 +90,4 @@ gem install bundler --no-document
rbenv rehash
mkdir -p "$HOME/.local/bin"
ln -sf "$HOME/.rbenv/shims/bundle" "$HOME/.local/bin/bundle"
bundle install
bundle install
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,5 @@
assets/vendor/hint.css/src
/vendor
/.sass-cache
.ruby-version
/tmp
Gemfile.lock
.jekyll-metadata
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.3.4
14 changes: 8 additions & 6 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@

source 'https://rubygems.org'

require 'json'
require 'net/http'
versions = JSON.parse(Net::HTTP.get(URI('https://pages.github.com/versions.json')))
gem 'jekyll', '~> 4.3'

gem 'github-pages', versions['github-pages']
# Jekyll plugins listed in _config.yml
gem 'jekyll-github-metadata', '~> 2.16'
gem 'jekyll-redirect-from', '~> 0.16'
gem 'jekyll-seo-tag', '~> 2.8'
gem 'jekyll-sitemap', '~> 1.4'

# Internationalization. Not on the GitHub Pages plugin whitelist, so the site is
# built and deployed from GitHub Actions (.github/workflows/deploy.yml) rather than
# by the native Pages build. ~> 1.5 keeps compatibility with the Jekyll version
# pinned by the github-pages gem.
# by the native Pages build.
gem 'jekyll-polyglot', '~> 1.5'

# https://github.com/jekyll/jekyll/issues/8523
Expand All @@ -29,4 +30,5 @@ group :test do
gem 'rake'
gem 'rspec'
gem 'rubocop'
gem 'safe_yaml', '~> 1.0'
end
Loading
Loading