<commit_before>#!/bin/bash

# Setup:
#   1) Install composer
#       $ mkdir ~/common
#       $ cd ~/common
#       $ curl -sS https://getcomposer.org/installer | /ramdisk/php/54/bin/php54-cli
#
# Deploy Process:
#    1) Pull latest changes from github
#       $ cd tmlpstats
#       $ git pull
#    2) Run deploy script
#       $ cd ..
#       $ ./deploy.sh
#
# Rollback Process:
#    1) Run deploy script with rollback option
#       $ ./deploy.sh rollback
#

SOURCE='tmlpstats'
DEST='../public_html/stage'
ROLLBACK='rollback'

if [ "$1" == "rollback" ]; then

    rm -rf $DEST/*
    cp -a $ROLLBACK/* $DEST/
    exit 0;
fi

# Leave rollback as is. It should contain whatever was last deployed to production

cd $SOURCE/
git pull --rebase

# Do actual deploy
sed -i.bak 's/php artisan/php-cli artisan/g' composer.json # workaround issue with artisan an bluehost
php-cli ~/common/composer.phar install --no-dev --optimize-autoloader
mv composer.json.bak composer.json # clean up

bin/snap.sh

php artisan migrate
cd ../

rsync -av --delete --filter='protect .env' --filter='protect storage/framework/sessions/*' --filter='protect storage/logs/*' --filter='protect storage/app/*' --filter='protect public/error_log' --exclude='.git*' --exclude='composer.*' --exclude='readme.md' --exclude='.env.example' --exclude='bin' $SOURCE/ $DEST<commit_msg>Add messageing on stage<commit_after>#!/bin/bash

# Setup:
#   1) Install composer
#       $ mkdir ~/common
#       $ cd ~/common
#       $ curl -sS https://getcomposer.org/installer | /ramdisk/php/54/bin/php54-cli
#
# Deploy Process:
#    1) Pull latest changes from github
#       $ cd tmlpstats
#       $ git pull
#    2) Run deploy script
#       $ cd ..
#       $ ./deploy.sh
#
# Rollback Process:
#    1) Run deploy script with rollback option
#       $ ./deploy.sh rollback
#

SOURCE='tmlpstats'
DEST='../public_html/stage'
ROLLBACK='rollback'

if [ "$1" == "rollback" ]; then

    rm -rf $DEST/*
    cp -a $ROLLBACK/* $DEST/
    exit 0;
fi

# Leave rollback as is. It should contain whatever was last deployed to production

cd $SOURCE/
echo "Pulling latest sources"
git pull --rebase

echo "Running composer"
# Do actual deploy
sed -i.bak 's/php artisan/php-cli artisan/g' composer.json # workaround issue with artisan an bluehost
php-cli ~/common/composer.phar install --no-dev --optimize-autoloader
mv composer.json.bak composer.json # clean up

echo "Snapping the database"
bin/snap.sh

echo "Running migrations"
php artisan migrate
cd ../

echo "Syncing files"
rsync -av --delete --filter='protect .env' --filter='protect storage/framework/sessions/*' --filter='protect storage/logs/*' --filter='protect storage/app/*' --filter='protect public/error_log' --exclude='.git*' --exclude='composer.*' --exclude='readme.md' --exclude='.env.example' --exclude='bin' $SOURCE/ $DEST
{'fraction_non_alphanumeric': 0.15254237288135594, 'fraction_numerical': 0.007062146892655367, 'mean_word_length': 3.0184397163120567, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6663993', 'n_tokens_mistral': 995, 'n_tokens_neox': 950, 'n_words': 273}