Add script to check whether binaries are named correctly

It is a simple approach but it works: Read the name of the binary from
the Cargo.toml file and check whether the name appears in the path.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
Matthias Beyer 2018-07-31 21:12:25 -07:00
parent ea77faeae2
commit 2fa5b2f4bd

View file

@ -0,0 +1,14 @@
#!/usr/bin/env bash
for file in `find bin -type f -name Cargo.toml -o -name main.rs -o -name ui.rs`;
do
echo "$file" | grep Cargo.toml > /dev/null 2>/dev/null && {
name=$(cat $file | grep description | sed 's,.*: ,,; s, .*,,')
echo "$file" | grep "$name" > /dev/null 2>/dev/null || {
echo "Crate in $file is named $name"
exit 1
}
}
done