2018-05-01 08:18:03 -04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
set -u
|
2017-08-28 17:05:12 -04:00
|
|
|
|
|
|
|
# This script compares the table of supported tools in both the README file
|
|
|
|
# and the doc/ale.txt file, so we can complain if they don't match up.
|
|
|
|
|
2017-10-22 04:42:36 -04:00
|
|
|
doc_file="$(mktemp -t doc.XXXXXXXX)"
|
2019-02-11 17:07:42 -05:00
|
|
|
doc_sorted_file="$(mktemp -t doc-sorted.XXXXXXXX)"
|
2017-10-22 04:42:36 -04:00
|
|
|
readme_file="$(mktemp -t readme.XXXXXXXX)"
|
2017-08-28 17:05:12 -04:00
|
|
|
|
2019-02-11 17:07:42 -05:00
|
|
|
while read -r; do
|
|
|
|
if [[ "$REPLY" =~ ^! ]]; then
|
|
|
|
language="${REPLY/!/}"
|
|
|
|
else
|
|
|
|
# shellcheck disable=SC2001
|
|
|
|
echo "$language - $REPLY"
|
|
|
|
fi
|
|
|
|
done < <(
|
|
|
|
grep '^\*\|^ *\*' doc/ale-supported-languages-and-tools.txt \
|
|
|
|
| sed -e '1,2d' \
|
|
|
|
| sed 's/^\* */!/' \
|
|
|
|
| sed 's/^ *\* *\|!!\|\^\|(.*)\|`//g' \
|
|
|
|
| sed 's/ *$//'
|
|
|
|
) > "$doc_file"
|
|
|
|
|
|
|
|
while read -r; do
|
|
|
|
if [[ "$REPLY" =~ ^! ]]; then
|
|
|
|
language="${REPLY/!/}"
|
|
|
|
else
|
|
|
|
# shellcheck disable=SC2001
|
|
|
|
echo "$language - $REPLY"
|
|
|
|
fi
|
|
|
|
done < <(
|
|
|
|
grep '^\*\|^ *\*' supported-tools.md \
|
|
|
|
| sed 's/^\* */!/' \
|
|
|
|
| sed 's/^ *\* *\|:floppy_disk:\|:warning:\|(.*)\|\[\|\].*\|-n flag//g' \
|
|
|
|
| sed 's/ *$//'
|
|
|
|
) > "$readme_file"
|
2017-08-28 17:05:12 -04:00
|
|
|
|
|
|
|
exit_code=0
|
|
|
|
|
2019-02-11 17:07:42 -05:00
|
|
|
# Sort the tools ignoring case, and complain when things are out of order.
|
2019-05-12 12:14:58 -04:00
|
|
|
LC_ALL=en_US.UTF-8 sort -f -k1,2 "$doc_file" -o "$doc_sorted_file"
|
2019-02-11 17:07:42 -05:00
|
|
|
|
|
|
|
diff -U0 "$doc_sorted_file" "$doc_file" || exit_code=$?
|
|
|
|
|
|
|
|
if ((exit_code)); then
|
|
|
|
echo
|
|
|
|
echo "The supported tools list isn't sorted properly"
|
|
|
|
echo
|
|
|
|
fi
|
|
|
|
|
2017-08-28 17:05:12 -04:00
|
|
|
diff -U0 "$readme_file" "$doc_file" || exit_code=$?
|
|
|
|
|
|
|
|
rm "$doc_file"
|
2019-02-11 17:07:42 -05:00
|
|
|
rm "$doc_sorted_file"
|
2017-08-28 17:05:12 -04:00
|
|
|
rm "$readme_file"
|
|
|
|
|
|
|
|
exit "$exit_code"
|