<commit_before>#!/bin/bash
set -e

TAG=1
BOOK=1
BUILD=1
SWAGGER=1
EXAMPLES=1
LINT=1

while [ "$#" -gt 1 ];  do
  if [ "$1" == "--no-lint" ];  then
    LINT=0
    shift
  fi

  if [ "$1" == "--no-build" ];  then
    BUILD=0
    shift
  fi

  if [ "$1" == "--recycle-build" ];  then
    BUILD=2
    shift
  fi

  if [ "$1" == "--no-swagger" ];  then
    SWAGGER=0
    shift
  fi

  if [ "$1" == "--no-examples" ];  then
    EXAMPLES=0
    shift
  fi

  if [ "$1" == "--no-commit" ];  then
    TAG=0
    shift
  fi

  if [ "$1" == "--no-book" ];  then
    BOOK=0
    shift
  fi
done

if [ "$#" -ne 1 ];  then
  echo "usage: $0 <major>.<minor>.<revision>"
  exit 1
fi

VERSION="$1"

if echo ${VERSION} | grep -q -- '-'; then
    echo "${VERSION} mustn't contain minuses! "
    exit 1
fi

if git tag | grep -q "^v$VERSION$";  then
  echo "$0: version $VERSION already defined"
  exit 1
fi

if fgrep -q "v$VERSION" CHANGELOG;  then
 echo "version $VERSION defined in CHANGELOG" 
else
  echo "$0: version $VERSION not defined in CHANGELOG"
  exit 1
fi

VERSION_MAJOR=`echo $VERSION | awk -F. '{print $1}'`
VERSION_MINOR=`echo $VERSION | awk -F. '{print $2}'`
VERSION_REVISION=`echo $VERSION | awk -F. '{print $3}'`

cat CMakeLists.txt \
  | sed -e "s~set(ARANGODB_VERSION_MAJOR.*~set(ARANGODB_VERSION_MAJOR      \"$VERSION_MAJOR\")~" \
  | sed -e "s~set(ARANGODB_VERSION_MINOR.*~set(ARANGODB_VERSION_MINOR      \"$VERSION_MINOR\")~" \
  | sed -e "s~set(ARANGODB_VERSION_REVISION.*~set(ARANGODB_VERSION_REVISION   \"$VERSION_REVISION\")~" \
  > CMakeLists.txt.tmp

mv CMakeLists.txt.tmp CMakeLists.txt<commit_msg>Fix commandline parsing of release script.<commit_after>#!/bin/bash
set -e

TAG=1
BOOK=1
BUILD=1
SWAGGER=1
EXAMPLES=1
LINT=1

while [ "$#" -gt 1 ];  do
    case "$1" in
        --no-lint)
            LINT=0
            shift
            ;;

        --no-build)
            BUILD=0
            shift
            ;;

        --recycle-build)
            BUILD=2
            shift
            ;;

        --no-swagger)
            SWAGGER=0
            shift
            ;;

        --no-examples)
            EXAMPLES=0
            shift
            ;;

        --no-commit)
            TAG=0
            shift
            ;;

        --no-book)
            BOOK=0
            shift
            ;;
        *)
            if test -n "${VERSION}"; then
                echo "we already have a version ${VERSION} aborting because of $1"
            fi
            VERSION="$1"
            shift
            ;;
    esac
done

if [ "$#" -ne 1 ];  then
  echo "usage: $0 <major>.<minor>.<revision>"
  exit 1
fi


if echo ${VERSION} | grep -q -- '-'; then
    echo "${VERSION} mustn't contain minuses! "
    exit 1
fi

if git tag | grep -q "^v$VERSION$";  then
  echo "$0: version $VERSION already defined"
  exit 1
fi

if fgrep -q "v$VERSION" CHANGELOG;  then
 echo "version $VERSION defined in CHANGELOG" 
else
  echo "$0: version $VERSION not defined in CHANGELOG"
  exit 1
fi

VERSION_MAJOR=`echo $VERSION | awk -F. '{print $1}'`
VERSION_MINOR=`echo $VERSION | awk -F. '{print $2}'`
VERSION_REVISION=`echo $VERSION | awk -F. '{print $3}'`

cat CMakeLists.txt \
  | sed -e "s~set(ARANGODB_VERSION_MAJOR.*~set(ARANGODB_VERSION_MAJOR      \"$VERSION_MAJOR\")~" \
  | sed -e "s~set(ARANGODB_VERSION_MINOR.*~set(ARANGODB_VERSION_MINOR      \"$VERSION_MINOR\")~" \
  | sed -e "s~set(ARANGODB_VERSION_REVISION.*~set(ARANGODB_VERSION_REVISION   \"$VERSION_REVISION\")~" \
  > CMakeLists.txt.tmp

mv CMakeLists.txt.tmp CMakeLists.txt
{'fraction_non_alphanumeric': 0.1543700340522134, 'fraction_numerical': 0.017309875141884222, 'mean_word_length': 2.083989501312336, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, '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': '5594242', 'n_tokens_mistral': 1409, 'n_tokens_neox': 1340, 'n_words': 328}