/
germanubis
/
rust-csv
Обзор
Документация
Войти
/
germanubis
/
rust-csv
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
ci/check-copy
40 строк
879 B
Andrew Gallant
style: regenerate and rustfmt examples
27 июн 2019, 02:51
27 июн 2019, 02:51
9423d80
Код
Авторство
О чём код?
#!/bin/bash set -e D="$(cd "$(dirname "$0")" && pwd -P)" REPO="$D/.." SCRIPTS="$REPO/scripts" TMPDIR="$(mktemp -d)" if [ $# != 1 ]; then echo "Usage: $(basename $0) (cookbook | tutorial)" >&2 exit 1 fi SOURCE="$1" errored() { rm -rf "$TMPDIR" echo "HINT: please run scripts/copy-examples" >&2 exit 1 } # Make sure the right rustfmt config is available. cp "$REPO/rustfmt.toml" "$TMPDIR/" "$SCRIPTS/copy-examples" \ --rust-file "$REPO/src/$SOURCE.rs" \ --example-dir "$TMPDIR" for new in "$TMPDIR"/*.rs; do name="$(basename "$new")" old="$REPO"/examples/"$name" if ! [ -f "$old" ]; then echo "ERROR: missing examples/$name" >&2 errored fi old="$(readlink -e "$REPO"/examples/"$name")" if ! diff "$old" "$new"; then echo "ERROR: examples/$name differs from ${name%%.rs} in src/$SOURCE.rs" >&2 errored fi done rm -rf "$TMPDIR"