<commit_before>#!/bin/bash

REPO="gavincabbage/il2missionplanner.com"
DEV_BRANCH="develop"
BETA_BRANCH="beta"
PROD_BRANCH="master"
SRC="src/"
DIST="dist/"
GIT_NAME="<NAME>"
GIT_EMAIL="<EMAIL>"
GIT_COMMIT_MSG="deploying to gh-pages"
BASENAME=`basename "${0}"`

function preamble {
    set -o errexit
    set -o errtrace
    set -o nounset
    set -o pipefail
}

function log { # usage: log <message>
    echo "[${BASENAME}] ${1}"
}

function abort { # usage: abort <code> <message>
    log "${2}: exit ${1}"
    exit "${1}"
}

function deploy_dev {
    log "Starting dev deployment"
    cd "${DIST}"
    log "Initializing git repo"
    git init
    git config user.name "${GIT_NAME}"
    git config user.email "${GIT_EMAIL}"
    git add .
    git commit --quiet -m "${GIT_COMMIT_MSG}"
    log "Pushing to gh-pages"
    git push --force --quiet "https://${GH_TOKEN}@${GH_REF}" master:gh-pages > /dev/null 2>&1
}

function main {

    bower install

    # Do not deploy any PRs or code from other repos
    if [[ "${TRAVIS_REPO_SLUG}" != "${REPO}" ]] || \
       [[ "${TRAVIS_PULL_REQUEST}" != "false" ]] || \
       ([[ "${TRAVIS_BRANCH}" != "${PROD_BRANCH}" ]] && \
        [[ "${TRAVIS_BRANCH}" != "${BETA_BRANCH}" ]] && \
        [[ "${TRAVIS_BRANCH}" != "${DEV_BRANCH}" ]])
    then
        npm run nodist
        abort "0" "No deploy necessary - exiting happily"
    fi

    npm run dist

    # Deploy dev branch - beta and prod deployments are handled by travis
    if [[ "${TRAVIS_BRANCH}" == "${DEV_BRANCH}" ]]
    then
        log "Deploying branch:${BETA_BRANCH} to beta"
        deploy_dev
    fi

    abort "0" "Finished deployment successfully!"
}

preamble
main<commit_msg>switched dev branch to polish and fixed dev deploy messaging<commit_after>#!/bin/bash

REPO="gavincabbage/il2missionplanner.com"
DEV_BRANCH="polish"
BETA_BRANCH="beta"
PROD_BRANCH="master"
SRC="src/"
DIST="dist/"
GIT_NAME="<NAME>"
GIT_EMAIL="<EMAIL>"
GIT_COMMIT_MSG="deploying to gh-pages"
BASENAME=`basename "${0}"`

function preamble {
    set -o errexit
    set -o errtrace
    set -o nounset
    set -o pipefail
}

function log { # usage: log <message>
    echo "[${BASENAME}] ${1}"
}

function abort { # usage: abort <code> <message>
    log "${2}: exit ${1}"
    exit "${1}"
}

function deploy_dev {
    log "Starting dev deployment"
    cd "${DIST}"
    log "Initializing git repo"
    git init
    git config user.name "${GIT_NAME}"
    git config user.email "${GIT_EMAIL}"
    git add .
    git commit --quiet -m "${GIT_COMMIT_MSG}"
    log "Pushing to gh-pages"
    git push --force --quiet "https://${GH_TOKEN}@${GH_REF}" master:gh-pages > /dev/null 2>&1
}

function main {

    bower install

    # Do not deploy any PRs or code from other repos
    if [[ "${TRAVIS_REPO_SLUG}" != "${REPO}" ]] || \
       [[ "${TRAVIS_PULL_REQUEST}" != "false" ]] || \
       ([[ "${TRAVIS_BRANCH}" != "${PROD_BRANCH}" ]] && \
        [[ "${TRAVIS_BRANCH}" != "${BETA_BRANCH}" ]] && \
        [[ "${TRAVIS_BRANCH}" != "${DEV_BRANCH}" ]])
    then
        npm run nodist
        abort "0" "No deploy necessary - exiting happily"
    fi

    npm run dist

    # Deploy dev branch - beta and prod deployments are handled by travis
    if [[ "${TRAVIS_BRANCH}" == "${DEV_BRANCH}" ]]
    then
        log "Deploying branch:${DEV_BRANCH} to dev"
        deploy_dev
    fi

    abort "0" "Finished deployment successfully!"
}

preamble
main
{'fraction_non_alphanumeric': 0.16461628588166374, 'fraction_numerical': 0.005858230814294083, 'mean_word_length': 3.0176470588235293, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 17, 'https://': 2, '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': '1490518', 'n_tokens_mistral': 1292, 'n_tokens_neox': 1239, 'n_words': 324}