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

function usage(){
    echo "teikei"
    echo
    echo "$0 dev   - run in development mode"
    echo "$0 build - build for production"
    echo "$0 prod  - run in production mode"
    echo "$0 clean - cleanup"
}


if [[ $# != 1 ]] ; then
    usage
    exit 1
fi

case $1 in
    dev)
    bundle exec foreman start --procfile=Procfile-dev
    ;;

    clean)
    echo "cleaning client..."
    cd client
    rm -rf build
    cd ..
    echo "cleaning server..."
    bundle exec rake assets:clobber
    rm -rf public/static
    rm app/assets/javascripts/app.js app/assets/javascripts/map.js app/assets/javascripts/new.js
    rm app/assets/stylesheets/app.css app/assets/stylesheets/map.css app/assets/stylesheets/new.css
    ;;

    build_client)
    echo "building client..."
    cd client
    npm install
    npm run build
    cd ..
    echo "copying client assets to asset pipeline..."
    mkdir -p public/static
    cp -r client/build/static/media public/static/media
    cp client/build/static/js/app.*.js app/assets/javascripts/app.js
    cp client/build/static/js/map.*.js app/assets/javascripts/map.js
    cp client/build/static/js/new.*.js app/assets/javascripts/new.js
    cp client/build/static/css/app.*.css app/assets/stylesheets/app.css
    cp client/build/static/css/map.*.css app/assets/stylesheets/map.css
    cp client/build/static/css/new.*.css app/assets/stylesheets/new.css
    ;;

    build_server)<commit_msg>Build client in production mode.<commit_after>#!/usr/bin/env bash

function usage(){
    echo "teikei"
    echo
    echo "$0 dev   - run in development mode"
    echo "$0 build - build for production"
    echo "$0 prod  - run in production mode"
    echo "$0 clean - cleanup"
}


if [[ $# != 1 ]] ; then
    usage
    exit 1
fi

case $1 in
    dev)
    bundle exec foreman start --procfile=Procfile-dev
    ;;

    clean)
    echo "cleaning client..."
    cd client
    rm -rf build
    cd ..
    echo "cleaning server..."
    bundle exec rake assets:clobber
    rm -rf public/static
    rm app/assets/javascripts/app.js app/assets/javascripts/map.js app/assets/javascripts/new.js
    rm app/assets/stylesheets/app.css app/assets/stylesheets/map.css app/assets/stylesheets/new.css
    ;;

    build_client)
    echo "building client..."
    cd client
    NODE_ENV=production npm install
    NODE_ENV=production npm run build
    cd ..
    echo "copying client assets to asset pipeline..."
    mkdir -p public/static
    cp -r client/build/static/media public/static/media
    cp client/build/static/js/app.*.js app/assets/javascripts/app.js
    cp client/build/static/js/map.*.js app/assets/javascripts/map.js
    cp client/build/static/js/new.*.js app/assets/javascripts/new.js
    cp client/build/static/css/app.*.css app/assets/stylesheets/app.css
    cp client/build/static/css/map.*.css app/assets/stylesheets/map.css
    cp client/build/static/css/new.*.css app/assets/stylesheets/new.css
    ;;

    build_server)
{'fraction_non_alphanumeric': 0.12177121771217712, 'fraction_numerical': 0.004696410600469641, 'mean_word_length': 2.508235294117647, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '849417', 'n_tokens_mistral': 1011, 'n_tokens_neox': 967, 'n_words': 245}