Skip to content

Commit 67a914c

Browse files
authored
Merge pull request #1380 from github/copilot/remove-github-pages-dependency
Remove github-pages gem dependency; declare explicit gems; commit Gemfile.lock
2 parents cb0391d + be7669e commit 67a914c

7 files changed

Lines changed: 410 additions & 41 deletions

File tree

.devcontainer/post-create.sh

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22
set -euo pipefail
33

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

48-
versions_json="$(curl -fsSL https://pages.github.com/versions.json)" || {
49-
echo "Failed to fetch https://pages.github.com/versions.json"
48+
ruby_version_file=".ruby-version"
49+
if [[ ! -f "${ruby_version_file}" ]]; then
50+
echo "Could not find ${ruby_version_file}"
5051
exit 1
51-
}
52-
53-
pages_ruby_version="$(
54-
printf '%s' "${versions_json}" |
55-
sed -n 's/.*"ruby"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' |
56-
head -n 1
57-
)"
52+
fi
5853

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

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

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

78-
rbenv install -s "${pages_ruby_version}"
79-
rbenv global "${pages_ruby_version}"
74+
rbenv install -s "${repo_ruby_version}"
75+
rbenv global "${repo_ruby_version}"
8076
rbenv rehash
8177

8278
for profile in "$HOME/.bashrc" "$HOME/.zshrc"; do
@@ -94,4 +90,4 @@ gem install bundler --no-document
9490
rbenv rehash
9591
mkdir -p "$HOME/.local/bin"
9692
ln -sf "$HOME/.rbenv/shims/bundle" "$HOME/.local/bin/bundle"
97-
bundle install
93+
bundle install

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,5 @@
55
assets/vendor/hint.css/src
66
/vendor
77
/.sass-cache
8-
.ruby-version
98
/tmp
10-
Gemfile.lock
119
.jekyll-metadata

.ruby-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.3.4

Gemfile

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@
22

33
source 'https://rubygems.org'
44

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

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

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

1718
# https://github.com/jekyll/jekyll/issues/8523
@@ -29,4 +30,5 @@ group :test do
2930
gem 'rake'
3031
gem 'rspec'
3132
gem 'rubocop'
33+
gem 'safe_yaml', '~> 1.0'
3234
end

0 commit comments

Comments
 (0)