From 94dad8029d94833f043412dfdb0382bf76fbcf14 Mon Sep 17 00:00:00 2001 From: Martin von Gagern Date: Wed, 23 Nov 2016 15:38:47 +0100 Subject: [PATCH] Check out test fonts in screenshotter.sh (#570) This ensures that running screenshots as indicated by the screenshotter readme will correctly render the Unicode examples, even if not run on Travis. It also fixes the commit ID of the unicode fonts. One alternative would have been using a git submodule. But as many tools will initialize submodules automatically, that would mean big downloads for anyone using such a tool to clone KaTeX. Another alternative would be tweaking the server to fetch the files on demand if the local copy is unavailable. But that would cause additional network overhead, so grabbing the files just once should be simpler. --- .travis.yml | 1 - dockers/Screenshotter/screenshotter.sh | 12 ++++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 5b6e2880..4228096c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,5 +10,4 @@ before_script: - docker images --no-trunc script: - npm test - - git clone https://github.com/Khan/KaTeX-test-fonts test/screenshotter/unicode-fonts - dockers/Screenshotter/screenshotter.sh --verify diff --git a/dockers/Screenshotter/screenshotter.sh b/dockers/Screenshotter/screenshotter.sh index b05a0494..fc0f3f7f 100755 --- a/dockers/Screenshotter/screenshotter.sh +++ b/dockers/Screenshotter/screenshotter.sh @@ -14,6 +14,18 @@ cleanup() { container= } +SS_DIR=$(dirname "$0") +TOP_DIR=${SS_DIR}/../.. +FONTS_DIR=${TOP_DIR}/test/screenshotter/unicode-fonts +if [[ ! -d "${FONTS_DIR}" ]]; then + echo "Cloning test fonts repository" + git clone https://github.com/Khan/KaTeX-test-fonts "${FONTS_DIR}" \ + || exit 2 +fi +pushd "${FONTS_DIR}" || exit 2 +git checkout --detach 99fa66a2da643218754c8236b9f9151cac71ba7c || exit 2 +popd || exit 2 + container= trap cleanup EXIT status=0