summaryrefslogtreecommitdiff
path: root/check
diff options
context:
space:
mode:
Diffstat (limited to 'check')
-rwxr-xr-xcheck63
1 files changed, 29 insertions, 34 deletions
diff --git a/check b/check
index 272ee63..ceffb0e 100755
--- a/check
+++ b/check
@@ -4,63 +4,58 @@ set -eu
verbose=false
moar=true
-while [ "$#" -gt 0 ] && $moar
-do
- case "$1" in
+while [ "$#" -gt 0 ] && $moar; do
+ case "$1" in
verbose | -v | --verbose)
- verbose=true
- shift 1
- ;;
- esac
+ verbose=true
+ shift 1
+ ;;
+ esac
done
hideok=
-if command -v chronic > /dev/null
-then
- hideok=chronic
+if command -v chronic >/dev/null; then
+ hideok=chronic
fi
quiet=-q
-if $verbose
-then
- quiet=
- hideok=
+if $verbose; then
+ quiet=
+ hideok=
fi
-
codegen() {
- $hideok subplot codegen "$1" --output "$2"
- rm -f test.log
- $hideok python3 test.py --log test.log
+ target="$(cargo metadata --format-version=1 |
+ python3 -c 'import sys, json; o = json.load(sys.stdin); print(o["target_directory"])')"
+ $hideok subplot codegen "$1" --output "$2"
+ rm -f test.log
+ $hideok python3 test.py --log test.log --env "CARGO_TARGET_DIR=$target"
}
docgen() {
- subplot docgen "$1" --output "$2"
+ subplot docgen "$1" --output "$2"
}
$hideok cargo build --all-targets
-if cargo --list | awk '{ print $1 }' | grep 'clippy$' > /dev/null
-then
- # shellcheck disable=SC2086
- cargo clippy $quiet
+if cargo --list | awk '{ print $1 }' | grep 'clippy$' >/dev/null; then
+ # shellcheck disable=SC2086
+ cargo clippy $quiet
fi
# shellcheck disable=SC2086
$hideok cargo test $quiet
-if cargo fmt --help > /dev/null 2> /dev/null
-then
- $hideok cargo fmt -- --check
+if cargo fmt --help >/dev/null 2>/dev/null; then
+ $hideok cargo fmt -- --check
fi
-$hideok ./mktestcert test.key test.pem hunter2
+$hideok ./mktestcert test.key test.pem hunter2
-for md in [^R]*.md
-do
- $hideok echo "$md ====================================="
- codegen "$md" test.py
- docgen "$md" "$(basename "$md" .md).pdf"
- docgen "$md" "$(basename "$md" .md).html"
- $hideok echo
+for md in [^R]*.md; do
+ $hideok echo "$md ====================================="
+ codegen "$md" test.py
+ docgen "$md" "$(basename "$md" .md).pdf"
+ docgen "$md" "$(basename "$md" .md).html"
+ $hideok echo
done
echo "Everything seems to be in order."