#!/bin/bash
#
# Copyright (c) 2024 Mike Tsao

for f in $(find . -name \*.rs -not -path "./target/*" -not -path "./vendor/*")
do
    if ! grep -q -E '^\/\/ Copyright \(c\) 202[4-9] Mike Tsao$' "$f"
    then
        echo "$f missing header"
        head -n 1 "$f"
        exit 1
    fi
done

cargo fmt --all && \
    cargo doc --no-deps --workspace --examples --document-private-items && \
    cargo test --workspace

# cargo build --no-default-features && \
# this is disabled - see https://github.com/ensnare-org/ensnare/issues/1
