<commit_before>command -v pdf2txt.py &>/dev/null 
if [ $? -ne 0 ]; then
    echo "pdf2txt.py not found"
    exit
fi

if [ ! -d manual ]; then
    echo "directory 'manual' does not exist"
    exit
fi

echo "build manual/manual.pdf"
make -C manual pdf &>/dev/null
if [ $? -ne 0 ]; then
    echo "failure during build!"
    exit
fi
echo "read manual.pdf"
PDF1=$(pdf2txt.py manual.pdf)
echo "read manual/manual.pdf"
PDF2=$(pdf2txt.py manual/manual.pdf)
if [ "$PDF1" != "$PDF2" ] ; then
    echo "manual.pdf and manual/manual.pdf differ!"
    exit
else
    echo "manual.pdf up-to-date"
fi

CMAKE_VERSION=$(grep -oE "set\(LIBCPPA_VERSION_(MAJOR|MINOR|PATCH) [0-9]+" CMakeLists.txt | awk '{ if (NR > 1) printf "." ; printf $2 } END { printf "\n" }')
MANUAL_VERSION=$(echo "$PDF1" | grep -oE "version [0-9]+(\.[0-9]+){2}" | awk '{print $2}')
CHANGELOG_VERSION=$(head -n1 ChangeLog | awk '{print $2}')
DOCU_VERSION=$(grep -oE "Version [0-9]+(\.[0-9]+){2}" Doxyfile.in  | awk '{print $2}')

echo "libcppa version in CMakeLists.txt is $CMAKE_VERSION"
echo "libcppa version in manual.pdf is $MANUAL_VERSION"
echo "libcppa version in ChangeLog is $CHANGELOG_VERSION"
echo "libcppa version in documentation is $DOCU_VERSION"

if [ "$CMAKE_VERSION" == "$MANUAL_VERSION" ] && [ "$CMAKE_VERSION" == "$CHANGELOG_VERSION" ] && [ "$CMAKE_VERSION" == "$DOCU_VERSION" ]; then
    echo "no errors found"
else
    echo "versions differ"
fi
<commit_msg>accept version MAJOR.MINOR version strings<commit_after>command -v pdf2txt.py &>/dev/null 
if [ $? -ne 0 ]; then
    echo "pdf2txt.py not found"
    exit
fi

if [ ! -d manual ]; then
    echo "directory 'manual' does not exist"
    exit
fi

echo "build manual/manual.pdf"
make -C manual pdf &>/dev/null
if [ $? -ne 0 ]; then
    echo "failure during build!"
    exit
fi
echo "read manual.pdf"
PDF1=$(pdf2txt.py manual.pdf)
echo "read manual/manual.pdf"
PDF2=$(pdf2txt.py manual/manual.pdf)
if [ "$PDF1" != "$PDF2" ] ; then
    echo "manual.pdf and manual/manual.pdf differ!"
    exit
else
    echo "manual.pdf up-to-date"
fi

function expand_version_string {
    echo "$1.0" | awk 'BEGIN {FS="."};{printf $1 "." $2 "." $3}';
}

CMAKE_VERSION=$(grep -oE "set\(LIBCPPA_VERSION_(MAJOR|MINOR|PATCH) [0-9]+" CMakeLists.txt | awk '{ if (NR > 1) printf "." ; printf $2 } END { printf "\n" }')
MANUAL_VERSION=$(echo "$PDF1" | grep -oE "version [0-9]+(\.[0-9]+){1,2}" | awk '{print $2}')
CHANGELOG_VERSION=$(head -n1 ChangeLog | awk '{print $2}')
DOCU_VERSION=$(grep -oE "Version [0-9]+(\.[0-9]+){1,2}" Doxyfile.in  | awk '{print $2}')

MANUAL_VERSION=$(expand_version_string "$MANUAL_VERSION")
CHANGELOG_VERSION=$(expand_version_string "$CHANGELOG_VERSION")
DOCU_VERSION=$(expand_version_string "$DOCU_VERSION")

echo "libcppa version in CMakeLists.txt is $CMAKE_VERSION"
echo "libcppa version in manual.pdf is $MANUAL_VERSION"
echo "libcppa version in ChangeLog is $CHANGELOG_VERSION"
echo "libcppa version in documentation is $DOCU_VERSION"

if [ "$CMAKE_VERSION" == "$MANUAL_VERSION" ] && [ "$CMAKE_VERSION" == "$CHANGELOG_VERSION" ] && [ "$CMAKE_VERSION" == "$DOCU_VERSION" ]; then
    echo "no errors found"
else
    echo "versions differ"
fi

{'fraction_non_alphanumeric': 0.1717171717171717, 'fraction_numerical': 0.020517676767676768, 'mean_word_length': 4.203612479474549, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3600049', 'n_tokens_mistral': 1203, 'n_tokens_neox': 1177, 'n_words': 324}