From 2fa5b2f4bd2ee5d011a83c480a0a9eb278aa5814 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 31 Jul 2018 21:12:25 -0700 Subject: [PATCH] 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 --- scripts/check-binary-names | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 scripts/check-binary-names diff --git a/scripts/check-binary-names b/scripts/check-binary-names new file mode 100644 index 00000000..075c0736 --- /dev/null +++ b/scripts/check-binary-names @@ -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