blob: 91a85fdf609a68e97142c2e6c424816210ea97a7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
#!/usr/bin/env bash
#
# Check whether wildcards are used in the Cargo.toml files, which is prohibited
# when publishing it to crates.io.
set -euo pipefail
# Obtain the root path of the git directory.
REPO=$(git rev-parse --show-toplevel)
readarray -d '' FILES < <(find "$REPO" -name "Cargo.toml" -print0)
echo -n "searching for wildcard version requirements ... "
grep -nE "^[[:alnum:]\-\_]+ = \"[[:digit:]\.]*\*\"$" "${FILES[@]}" && exit 1
grep -nE "version = \"[[:digit:]\.]*\*\"" "${FILES[@]}" && exit 1
echo "ok"
|