Files

43 lines
1.3 KiB
Bash
Executable File

#!/bin/sh
set -eu
ROOT=$(CDPATH= cd -- "$(dirname -- "$0")/../.." && pwd)
cd "$ROOT"
export BUNDLE_GEMFILE="$ROOT/docker/dev/Gemfile"
export GEMS_SOURCE=https://rubygems.org
if [ ! -f _bin/pagefind ] || head -c 128 _bin/pagefind | grep -q 'git-lfs.github.com'; then
echo "error: LFS assets are missing. Run 'git lfs pull' on the host." >&2
exit 1
fi
if head -c 128 assets/fonts/inter/v18/UcCm3FwrK3iLTcvnUwAT9nA2.woff2 2>/dev/null | grep -q 'git-lfs.github.com'; then
echo "error: LFS font assets are pointers. Run 'git lfs pull' on the host." >&2
exit 1
fi
echo "==> Installing Ruby gems"
bundle check || bundle install
echo "==> Installing Node modules"
pnpm install --frozen-lockfile --store-dir=/tmp/pnpm-store
if [ ! -f privkey.pem ]; then
echo "==> Generating a development ActivityPub key"
openssl genrsa -out privkey.pem 2048
chmod 600 privkey.pem
fi
if [ ! -f assets/fonts/forkawesome-webfont.woff2 ]; then
echo "==> Generating the Fork Awesome subset"
./_bin/subset_fork_awesome.sh || echo "warning: could not generate Fork Awesome subset" >&2
fi
# Build before starting the server so Pagefind's output is present when
# Jekyll creates its static-file list.
echo "==> Building the site"
bundle exec jekyll build --config _config.yml,_config.docker.yml
echo "==> Setup complete"