#!/usr/bin/env bash

# devel invocation of sitegen.py

source "$(dirname "$0")/common"

set_isabelle_tool

STATUS_FILE="$(readlink -f "$1")"
shift

cd "$(dirname "$0")/.."

"$ISABELLE_TOOL" afp_site_gen \
  -f \
  -H out/hugo \
  -O web \
  -D "$STATUS_FILE" \
  "$@"

mkdir -p release
echo "Packing tars ..."

find thys -mindepth 1 -maxdepth 1 -type d | while read -r LINE; do
  ENTRY="$(basename "$LINE")"
  tar -C thys -czf "release/afp-${ENTRY}-current.tar.gz" "$ENTRY"
done
