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

# Usage:
#   $ ./deploy.sh [quick] [<logname>]

package_name="tiddlywebplugins.tiddlyspace"
host="tiddlyspace.com"
remote_sudo_id="tiddlyweb"
instance_dir="/home/tiddlyweb/tiddlywebs/tiddlyspace.com"

set -e
set -x

if [ ! -d .git ]; then
    echo "ERROR: script must be executed from repository root"
    exit 1
fi

# TODO: use getopts
if [ "$1" = "quick" ]; then
    pip_options="--no-dependencies"
    shift
fi
if [ -n "$1" ]; then
    log_name="$1@"
fi

host="${log_name}${host}"
sql="DELETE IGNORE FROM tiddler WHERE bag='system' OR bag='tiddlyspace' \
    OR bag='system-plugins_public' \
    OR bag='system-info_public' \
    OR bag='system-images_public' \
    OR bag='system-theme_public';"
ssh $host "sudo pip install --upgrade $pip_options $package_name && " \
    "mysql -u tiddlyweb tiddlyspace2 -e \"${sql}\" && " \
    "cd $instance_dir && sudo -u $remote_sudo_id twanager update && " \
    "sudo apache2ctl restart && echo INFO: deployment complete"<commit_msg>Update deploy.sh to cover some recent learnings<commit_after>#!/usr/bin/env bash

# Usage:
#   $ ./deploy.sh [quick] [<logname>]

package_name="tiddlywebplugins.tiddlyspace"
host="tiddlyspace.com"
remote_sudo_id="tiddlyweb"
instance_dir="/home/tiddlyweb/tiddlywebs/tiddlyspace.com"

set -e
set -x

if [ ! -d .git ]; then
    echo "ERROR: script must be executed from repository root"
    exit 1
fi

# TODO: use getopts
if [ "$1" = "quick" ]; then
    pip_options="--no-dependencies"
    shift
fi
if [ -n "$1" ]; then
    log_name="$1@"
fi

host="${log_name}${host}"
sql="DELETE IGNORE FROM tiddler WHERE bag='system' \
    OR bag='tiddlyspace' \
    OR bag='common' \
    OR bag='system-plugins_public' \
    OR bag='system-info_public' \
    OR bag='system-images_public' \
    OR bag='system-theme_public';"
ssh $host "sudo pip install --upgrade $pip_options $package_name && " \
    "mysql -u tiddlyweb tiddlyspace2 -e \"${sql}\" && " \
    "cd $instance_dir && sudo -u $remote_sudo_id twanager update && " \
    "sudo apache2ctl restart && sudo /etc/init.d/memcached restart && " \
    "echo INFO: deployment complete"
{'fraction_non_alphanumeric': 0.15503512880562062, 'fraction_numerical': 0.005620608899297424, 'mean_word_length': 3.633405639913232, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '6452306', 'n_tokens_mistral': 809, 'n_tokens_neox': 767, 'n_words': 192}