<commit_before>#!/usr/bin/env bash

#
#  Copyright (C) 2017 <NAME> (Akvo Foundation)
#
#  This file is part of Akvo FLOW.
#
#  Akvo FLOW is free software: you can redistribute it and modify it under the terms of
#  the GNU Affero General Public License (AGPL) as published by the Free Software Foundation,
#  either version 3 of the License or any later version.
#
#  Akvo FLOW is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
#  without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#  See the GNU Affero General Public License included below for more details.
#
#  The full license text can also be seen at <http://www.gnu.org/licenses/agpl.html>.
#

set -eu

SRC_DIR="/app/src"
APP_ENGINE_SDK_VERSION="1.9.54"
APP_ENGINE_SDK_FILE="appengine-java-sdk-1.9.54.zip"

if [[ ! -d "$HOME/.cache/appengine-java-sdk-$APP_ENGINE_SDK_VERSION" ]]; then
    unzip "$HOME/.cache/$APP_ENGINE_SDK_FILE" -d "$HOME/.cache"
fi

cd "$SRC_DIR/Dashboard"

bundle exec rake watchbg > "$SRC_DIR/rake.log" 2>&1 &

if [[ ! -f "$SRC_DIR/GAE/target/akvo-flow/admin/frames/users.js" ]]; then
    cd "$SRC_DIR/Dashboard/app/cljs"
    lein build
else
    echo "Skipping ClojureScript build ..."
fi

cd "$SRC_DIR/GAE"

cp -f build.properties.template build.properties

sed -i "s|^sdk\.dir=.*|sdk\.dir=$HOME/.cache/appengine-java-sdk-$APP_ENGINE_SDK_VERSION|" build.properties

if [[ ! -f "$SRC_DIR/GAE/target/akvo-flow/WEB-INF/appengine-generated/local_db.bin" ]]; then
    mkdir -p "$SRC_DIR/GAE/target/akvo-flow/WEB-INF/appengine-generated/"
    wget "https://s3-eu-west-1.amazonaws.com/akvoflow/test-data/local_db.bin" -O "$SRC_DIR/GAE/target/akvo-flow/WEB-INF/appengine-generated/local_db.bin"
fi

if [[ ! -f "$SRC_DIR/GAE/war/WEB-INF/appengine-web.xml" ]]; then
    cp "$SRC_DIR/tests/dev-appengine-web.xml" "$SRC_DIR/GAE/war/WEB-INF/appengine-web.xml"
fi

mvn package appengine:devserver_start

tail -F ./target/akvo-flow/flow0.log "$SRC_DIR/rake.log" "$SRC_DIR/lein.log"<commit_msg>[#2553] Copying the appengine-web.xml to the target dir<commit_after>#!/usr/bin/env bash

#
#  Copyright (C) 2017 <NAME> (Akvo Foundation)
#
#  This file is part of Akvo FLOW.
#
#  Akvo FLOW is free software: you can redistribute it and modify it under the terms of
#  the GNU Affero General Public License (AGPL) as published by the Free Software Foundation,
#  either version 3 of the License or any later version.
#
#  Akvo FLOW is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
#  without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#  See the GNU Affero General Public License included below for more details.
#
#  The full license text can also be seen at <http://www.gnu.org/licenses/agpl.html>.
#

set -eu

SRC_DIR="/app/src"
APP_ENGINE_SDK_VERSION="1.9.54"
APP_ENGINE_SDK_FILE="appengine-java-sdk-1.9.54.zip"

if [[ ! -d "$HOME/.cache/appengine-java-sdk-$APP_ENGINE_SDK_VERSION" ]]; then
    unzip "$HOME/.cache/$APP_ENGINE_SDK_FILE" -d "$HOME/.cache"
fi

cd "$SRC_DIR/Dashboard"

bundle exec rake watchbg > "$SRC_DIR/rake.log" 2>&1 &

if [[ ! -f "$SRC_DIR/GAE/target/akvo-flow/admin/frames/users.js" ]]; then
    cd "$SRC_DIR/Dashboard/app/cljs"
    lein build
else
    echo "Skipping ClojureScript build ..."
fi

cd "$SRC_DIR/GAE"

cp -f build.properties.template build.properties

sed -i "s|^sdk\.dir=.*|sdk\.dir=$HOME/.cache/appengine-java-sdk-$APP_ENGINE_SDK_VERSION|" build.properties

if [[ ! -f "$SRC_DIR/GAE/target/akvo-flow/WEB-INF/appengine-generated/local_db.bin" ]]; then
    mkdir -p "$SRC_DIR/GAE/target/akvo-flow/WEB-INF/appengine-generated/"
    wget "https://s3-eu-west-1.amazonaws.com/akvoflow/test-data/local_db.bin" -O "$SRC_DIR/GAE/target/akvo-flow/WEB-INF/appengine-generated/local_db.bin"
fi

if [[ ! -f "$SRC_DIR/GAE/target/akvo-flow/WEB-INF/appengine-web.xml" ]]; then
    mkdir -p "$SRC_DIR/GAE/target/akvo-flow/WEB-INF/"
    cp "$SRC_DIR/tests/dev-appengine-web.xml" "$SRC_DIR/GAE/target/akvo-flow/WEB-INF/appengine-web.xml"
fi

mvn package appengine:devserver_start

tail -F ./target/akvo-flow/flow0.log "$SRC_DIR/rake.log" "$SRC_DIR/lein.log"
{'fraction_non_alphanumeric': 0.1434052757793765, 'fraction_numerical': 0.009592326139088728, 'mean_word_length': 3.91283863368669, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 7}, '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': '7514909', 'n_tokens_mistral': 1615, 'n_tokens_neox': 1551, 'n_words': 369}