diff options
-rw-r--r-- | default.nix | 10 | ||||
-rwxr-xr-x | scripts/assert-content.sh | 6 |
2 files changed, 15 insertions, 1 deletions
diff --git a/default.nix b/default.nix index 5f6663d..c664429 100644 --- a/default.nix +++ b/default.nix @@ -22,6 +22,15 @@ in rec { touch $out ''; }); + assertContent = utils.baseTask.overrideAttrs (baseAttrs: { + name = "${baseAttrs.name}-assert-content"; + buildInputs = baseAttrs.buildInputs ++ [ pkgs.jq ]; + buildPhase = '' + patchShebangs . + ./scripts/assert-content.sh "${subtasks.docs}/site.json" + touch $out + ''; + }); docs = utils.baseTask.overrideAttrs (baseAttrs: { name = "${baseAttrs.name}-docs"; buildInputs = [ jekyllEnv ]; @@ -35,6 +44,7 @@ in rec { (utils.shellcheck null) (utils.fixme null) subtasks.hunspellCheck + subtasks.assertContent ]; shell = pkgs.mkShell rec { name = "website-shell"; diff --git a/scripts/assert-content.sh b/scripts/assert-content.sh index f9ea345..470fcb7 100755 --- a/scripts/assert-content.sh +++ b/scripts/assert-content.sh @@ -1,9 +1,13 @@ #!/usr/bin/env bash set -Eeuo pipefail +end="\033[0m" +red="\033[0;31m" +red() { echo -e "${red}${1}${end}"; } + JSON="${1:-}" [[ -z "${JSON}" ]] && { - echo 'Missing input JSON file.' + red 'Missing input JSON file.' exit 2 } |