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

# Environment variables may not be loaded under all conditions.
if [ -z "${TWLIGHT_HOME}" ]
then
    source /etc/environment
fi

# Load virtual environment to leverage the common sanity checks, not because we need python (we don't).
if source ${TWLIGHT_HOME}/bin/virtualenv_activate.sh
then
    # Fetch latest code from ${TWLIGHT_GIT_REVISION}.
    cd ${TWLIGHT_HOME}
    git checkout .
    git pull origin ${TWLIGHT_GIT_REVISION}
else
    exit 1
fi

# Update pip dependencies.
bash ${TWLIGHT_HOME}/bin/virtualenv_pip_update.sh || exit 1

# Process static assets.
bash ${TWLIGHT_HOME}/bin/virtualenv_clearstatic.sh || exit 1

# Run migrations.
bash ${TWLIGHT_HOME}/bin/virtualenv_migrate.sh || exit 1

# Compile translations.
bash ${TWLIGHT_HOME}/bin/virtualenv_translate.sh || exit 1<commit_msg>unique sanity checks for bin/virtualenv_update.sh<commit_after>#!/usr/bin/env bash
set -eo pipefail

# Environment variables may not be loaded under all conditions.
if [ -z "${TWLIGHT_HOME}" ]
then
    source /etc/environment
fi

# Verify that the unix user has proper group membership.
if groups | grep &>/dev/null "\b${TWLIGHT_UNIXNAME}\b"
then
    # Verify that the unix user can talk to the remote.
	if git fetch --dry-run
	then
        # Fetch latest code from ${TWLIGHT_GIT_REVISION}.
        cd ${TWLIGHT_HOME}
        git checkout .
        git pull origin ${TWLIGHT_GIT_REVISION}
	else
	    exit 1
	fi
else
    echo "git pull must be run as member of ${TWLIGHT_UNIXNAME} group!"
    exit 1
fi

# Update pip dependencies.
bash ${TWLIGHT_HOME}/bin/virtualenv_pip_update.sh

# Process static assets.
bash ${TWLIGHT_HOME}/bin/virtualenv_clearstatic.sh

# Run migrations.
bash ${TWLIGHT_HOME}/bin/virtualenv_migrate.sh

# Compile translations.
bash ${TWLIGHT_HOME}/bin/virtualenv_translate.sh
{'fraction_non_alphanumeric': 0.0962800875273523, 'fraction_numerical': 0.0038293216630196935, 'mean_word_length': 3.943243243243243, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '778654', 'n_tokens_mistral': 628, 'n_tokens_neox': 602, 'n_words': 185}