#!/usr/bin/env bash
set -euo pipefail

ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"

scripts=(
  "$ROOT_DIR/scripts/ops/backup-prod.sh"
  "$ROOT_DIR/scripts/ops/backup-job.sh"
  "$ROOT_DIR/scripts/ops/preflight-prod.sh"
  "$ROOT_DIR/scripts/ops/deploy-prod.sh"
  "$ROOT_DIR/scripts/ops/prune-backups.sh"
  "$ROOT_DIR/scripts/ops/restore-prod.sh"
  "$ROOT_DIR/scripts/ops/restore-drill.sh"
  "$ROOT_DIR/scripts/ops/staging-drill.sh"
  "$ROOT_DIR/scripts/ops/verify-backup.sh"
  "$ROOT_DIR/scripts/ops/smoke-prod.sh"
)

echo "[step] shell syntax check..."
bash -n "${scripts[@]}"

echo "[step] help smoke check..."
for script in "${scripts[@]}"; do
  bash "$script" --help >/dev/null
done

echo "[ok] ops script checks passed"
