<commit_before>"""
Deploy this project in dev/stage/production.

Requires commander_ which is installed on the systems that need it.

.. _commander: https://github.com/oremj/commander
"""

import os
import sys

sys.path.append(os.path.dirname(os.path.abspath(__file__)))

from commander.deploy import task, hostgroups
import commander_settings as settings

venv_path = os.path.abspath('../venv')


@task
def update_code(ctx, tag):
    """Update the code to a specific git reference (tag/sha/etc)."""
    with ctx.lcd(settings.SRC_DIR):
        ctx.local('git checkout %s' % tag)
        ctx.local('git pull -f')
        ctx.local("find . -type f -name '*.pyc' -delete")
        ctx.local('virtualenv %s' % venv_path)

        # Activate virtualenv to append to path.
        activate_env = os.path.join(venv_path, 'bin', 'activate_this.py')
        execfile(activate_env, dict(__file__=activate_env))

        ctx.local('%s/bin/pip install bin/peep-2.1.1.tar.gz' % venv_path)
        ctx.local('%s/bin/peep install -r requirements.txt' % venv_path)
        ctx.local('virtualenv --relocatable %s' % venv_path)


@task
def update_assets(ctx):
    with ctx.lcd(settings.SRC_DIR):
        ctx.local(<commit_msg>bug 1125194 - no absolute path except for execfile()<commit_after>"""
Deploy this project in dev/stage/production.

Requires commander_ which is installed on the systems that need it.

.. _commander: https://github.com/oremj/commander
"""

import os
import sys

sys.path.append(os.path.dirname(os.path.abspath(__file__)))

from commander.deploy import task, hostgroups
import commander_settings as settings

venv_path = '../venv'


@task
def update_code(ctx, tag):
    """Update the code to a specific git reference (tag/sha/etc)."""
    with ctx.lcd(settings.SRC_DIR):
        ctx.local('git checkout %s' % tag)
        ctx.local('git pull -f')
        ctx.local("find . -type f -name '*.pyc' -delete")
        ctx.local('virtualenv %s' % venv_path)

        # Activate virtualenv to append to path.
        activate_env = os.path.join(
            settings.SRC_DIR, venv_path, 'bin', 'activate_this.py'
        )
        execfile(activate_env, dict(__file__=activate_env))

        ctx.local('%s/bin/pip install bin/peep-2.1.1.tar.gz' % venv_path)
        ctx.local('%s/bin/peep install -r requirements.txt' % venv_path)
        ctx.local('virtualenv --relocatable %s' % venv_path)


@task
def update_assets(ctx):
    with ctx.lcd(settings.SRC_DIR):
        ctx.local(
{'fraction_non_alphanumeric': 0.1343825665859564, 'fraction_numerical': 0.005246166263115416, 'mean_word_length': 3.1734006734006734, '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': '877432', 'n_tokens_mistral': 847, 'n_tokens_neox': 826, 'n_words': 202}