<commit_before># -*- coding: utf-8 -*-

from fabric.decorators import task
from fabric.context_managers import cd, prefix
from fabric.state import env
from fabric.api import execute
from fabric.task_utils import crawl
from fabric import state
from utils import run_task, has_task
import paths
import time
from hooks import run_hook, has_hook


@task
def setup():
    run_hook("before_setup")

    # Create shared folder
    env.run("mkdir -p %s" % (paths.get_shared_path()))
    env.run("chmod 755 %s" % (paths.get_shared_path()))

    # Create uploads folder
    env.run("mkdir -p %s" % (paths.get_upload_path()))
    env.run("chmod 777 %s" % (paths.get_upload_path()))

    run_hook("setup")
    run_hook("after_setup")


@task
def deploy():
    if not has_hook("copy"):
        raise Exception("No copy method has been defined")
        return

    # run_task("before_deploy")
    run_hook("before_deploy")

    release_name = int(time.time())
    release_path = paths.get_releases_path(release_name)

    env.current_release = release_path

    try:
        run_hook("copy")
    except Exception, e:
        print e
        print "Error occured on copy, starting rollback..."
        run_task("rollback")

    # Symlink current folder<commit_msg>Fixed so rollback exception would end properly<commit_after># -*- coding: utf-8 -*-

from fabric.decorators import task
from fabric.context_managers import cd, prefix
from fabric.state import env
from fabric.api import execute
from fabric.task_utils import crawl
from fabric import state
from utils import run_task, has_task
import paths
import time
from hooks import run_hook, has_hook


@task
def setup():
    run_hook("before_setup")

    # Create shared folder
    env.run("mkdir -p %s" % (paths.get_shared_path()))
    env.run("chmod 755 %s" % (paths.get_shared_path()))

    # Create uploads folder
    env.run("mkdir -p %s" % (paths.get_upload_path()))
    env.run("chmod 777 %s" % (paths.get_upload_path()))

    run_hook("setup")
    run_hook("after_setup")


@task
def deploy():
    if not has_hook("copy"):
        raise Exception("No copy method has been defined")
        return

    # run_task("before_deploy")
    run_hook("before_deploy")

    release_name = int(time.time())
    release_path = paths.get_releases_path(release_name)

    env.current_release = release_path

    try:
        run_hook("copy")
    except Exception, e:
        print e
        print "Error occured on copy, starting rollback..."
        run_task("rollback")
        return

    # Symlink current folder
{'fraction_non_alphanumeric': 0.10989010989010989, 'fraction_numerical': 0.005494505494505495, 'mean_word_length': 3.4100346020761245, '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': '2053737', 'n_tokens_mistral': 813, 'n_tokens_neox': 772, 'n_words': 226}