<commit_before>#
# loader install
#
# preps each graph directory by adding config stuff to otp.jar, as well as
# (possibly) copying cached data (like NED tiles)
#
# June 2016
#

WEB_JAR=${WEB_JAR:="http://maven.conveyal.com.s3.amazonaws.com/org/opentripplanner/otp/0.20.0/otp-0.20.0-shaded.jar"}

OTP_DIR=${OTP_DIR:="../OpenTripPlanner"}
OTP_JAR=${OTP_JAR:="$OTP_DIR/target/otp-*-shaded.jar"}

EXE_DIR=${EXE_DIR:="ott/loader/otp/graph/$GRAPH_NAME"}
EXE_JAR=${EXE_JAR:="$EXE_DIR/otp.jar"}
CACHE_JAR=${CACHE_JAR:="../cache/otp.jar"}

CFG_DIR=${CFG_DIR:="ott/loader/otp/graph/config"}
TILE_DIR=${TILE_DIR:="../cache/ned/"}

link=false
if [[ $1 == "link" ]]; then
  link=true
fi

##
## build OTP.jar and copy it to a given location
##
function build_jar()
{
    if [ ! -f $OTP_JAR ];
    then
        cd $OTP_DIR
        echo "BUILDING $OTP_JAR"
        mvn package -DskipTests
        cd -
    fi
    if [ -f $OTP_JAR ];
    then
        mv $EXE_JAR ${EXE_JAR}.old
        echo "cp $OTP_JAR $EXE_JAR"
        cp $OTP_JAR $EXE_JAR
    fi
}

##
## download pre-built release of OTP
##
function wget_jar()
{
    if [ ! -f $CACHE_JAR ];
    then
        wget -O $EXE_JAR $WEB_JAR
    else
        cp $CACHE_JAR $EXE_JAR
    fi
}

##
## add the config.js file to our jar file
##
# test
function fix_config_jar()
{
    if [ -f $EXT_JAR ];
    then
        cp $CFG_DIR/logback.xml $EXE_DIR

        echo "config and images inserted into $EXE_JAR"
        cd $EXE_DIR
        jar uf otp.jar logback.xml
        jar uf otp.jar client/js/otp/config.js
        jar uf otp.jar client/images/agency_logo.png
        cd -
    fi
}

##
## add the config.js file to our jar file
##
function misc()
{
    echo "misc..."

    # cp config
    for x in build-config.json router-config.json
    do
        if [ ! -f $EXT_DIR/$x ];<commit_msg>fix install script ... don't ovrwrt log config<commit_after>#
# loader install
#
# preps each graph directory by adding config stuff to otp.jar, as well as
# (possibly) copying cached data (like NED tiles)
#
# June 2016
#

WEB_JAR=${WEB_JAR:="http://maven.conveyal.com.s3.amazonaws.com/org/opentripplanner/otp/0.20.0/otp-0.20.0-shaded.jar"}

OTP_DIR=${OTP_DIR:="../OpenTripPlanner"}
OTP_JAR=${OTP_JAR:="$OTP_DIR/target/otp-*-shaded.jar"}

EXE_DIR=${EXE_DIR:="ott/loader/otp/graph/$GRAPH_NAME"}
EXE_JAR=${EXE_JAR:="$EXE_DIR/otp.jar"}
CACHE_JAR=${CACHE_JAR:="../cache/otp.jar"}

CFG_DIR=${CFG_DIR:="ott/loader/otp/graph/config"}
TILE_DIR=${TILE_DIR:="../cache/ned/"}

link=false
if [[ $1 == "link" ]]; then
  link=true
fi

##
## build OTP.jar and copy it to a given location
##
function build_jar()
{
    if [ ! -f $OTP_JAR ];
    then
        cd $OTP_DIR
        echo "BUILDING $OTP_JAR"
        mvn package -DskipTests
        cd -
    fi
    if [ -f $OTP_JAR ];
    then
        mv $EXE_JAR ${EXE_JAR}.old
        echo "cp $OTP_JAR $EXE_JAR"
        cp $OTP_JAR $EXE_JAR
    fi
}

##
## download pre-built release of OTP
##
function wget_jar()
{
    if [ ! -f $CACHE_JAR ];
    then
        wget -O $EXE_JAR $WEB_JAR
    else
        cp $CACHE_JAR $EXE_JAR
    fi
}

##
## add the config.js file to our jar file
##
# test
function fix_config_jar()
{
    if [ -f $EXT_JAR ];
    then
        if [ ! -f $EXE_DIR/logback.xml ];
        then
            cp $CFG_DIR/logback.xml $EXE_DIR
        fi

        echo "config and images inserted into $EXE_JAR"
        cd $EXE_DIR
        jar uf otp.jar logback.xml
        jar uf otp.jar client/js/otp/config.js
        jar uf otp.jar client/images/agency_logo.png
        cd -
    fi
}

##
## add the config.js file to our jar file
##
function misc()
{
    echo "misc..."

    # cp config
    for x in build-config.json router-config.json
    do
        if [ ! -f $EXT_DIR/$x ];
{'fraction_non_alphanumeric': 0.1481679593474191, 'fraction_numerical': 0.007488633324418294, 'mean_word_length': 2.50187265917603, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 5}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3822244', 'n_tokens_mistral': 1561, 'n_tokens_neox': 1526, 'n_words': 339}