<commit_before>#!/bin/bash

# common header for test scripts

SRC_DIR=$(cd `dirname $0` && pwd)
DIR=${TMP_DIR:-$SRC_DIR}

errorMsg() {
   echo "$*" 1>&2
}
fail(){
    errorMsg "FAIL: $@"
    exit 2
}
assert(){
    # assert expected, actual
    if [ "$1" != "$2" ] ; then
        fail "Expected value \"$1\" but saw: \"$2\" ${3}"
    fi
}

# modify to point to xmlstarlet
XMLSTARLET=${XMLSTARLET:-xmlstarlet}

RDECK_PROJECTS=${RDECK_PROJECTS:-$RDECK_BASE/projects}
RDECK_ETC=${RDECK_ETC:-$RDECK_BASE/etc}

# xmlstarlet select xpath
# usage: xmlsel XPATH file
xmlsel(){
    xpath=$1
    shift
    $XMLSTARLET sel -T -t -v "$xpath" $*
}

API_CURRENT_VERSION=6

API_VERSION=${API_VERSION:-$API_CURRENT_VERSION}


# curl opts to use a cookie jar, and follow redirects, showing only errors
if [ -n "$RDAUTH" ] ; then 
    AUTHHEADER="X-RunDeck-Auth-Token: $RDAUTH"
    CURLOPTS="-s -S -L"
else
    CURLOPTS="-s -S -L -c $DIR/cookies -b $DIR/cookies"
fi
CURL="curl $CURLOPTS"
docurl(){
    if [ -n "$RDAUTH" ] ; then
        if [ "true" == "$RDDEBUG" ] ; then
            echo $CURL -H "$AUTHHEADER" $* 1>&2
        fi
        $CURL -H "$AUTHHEADER" $*<commit_msg>Update api version used in api test scripts<commit_after>#!/bin/bash

# common header for test scripts

SRC_DIR=$(cd `dirname $0` && pwd)
DIR=${TMP_DIR:-$SRC_DIR}

errorMsg() {
   echo "$*" 1>&2
}
fail(){
    errorMsg "FAIL: $@"
    exit 2
}
assert(){
    # assert expected, actual
    if [ "$1" != "$2" ] ; then
        fail "Expected value \"$1\" but saw: \"$2\" ${3}"
    fi
}

# modify to point to xmlstarlet
XMLSTARLET=${XMLSTARLET:-xmlstarlet}

RDECK_PROJECTS=${RDECK_PROJECTS:-$RDECK_BASE/projects}
RDECK_ETC=${RDECK_ETC:-$RDECK_BASE/etc}

# xmlstarlet select xpath
# usage: xmlsel XPATH file
xmlsel(){
    xpath=$1
    shift
    $XMLSTARLET sel -T -t -v "$xpath" $*
}

API_CURRENT_VERSION=7

API_VERSION=${API_VERSION:-$API_CURRENT_VERSION}


# curl opts to use a cookie jar, and follow redirects, showing only errors
if [ -n "$RDAUTH" ] ; then 
    AUTHHEADER="X-RunDeck-Auth-Token: $R<PASSWORD>"
    CURLOPTS="-s -S -L"
else
    CURLOPTS="-s -S -L -c $DIR/cookies -b $DIR/cookies"
fi
CURL="curl $CURLOPTS"
docurl(){
    if [ -n "$RDAUTH" ] ; then
        if [ "true" == "$RDDEBUG" ] ; then
            echo $CURL -H "$AUTHHEADER" $* 1>&2
        fi
        $CURL -H "$AUTHHEADER" $*
{'fraction_non_alphanumeric': 0.17198808003405705, 'fraction_numerical': 0.011068539804171988, 'mean_word_length': 3.1083916083916083, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 10}, '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': '5482152', 'n_tokens_mistral': 956, 'n_tokens_neox': 924, 'n_words': 233}