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


import os

from fabric.api import env, local


env.project_dir = os.path.dirname(os.path.realpath(__file__))
env.content_dir = env.project_dir + '/content'
env.output_dir = env.project_dir + '/output'
env.config_dir = env.project_dir + '/config'


def clean():
    if os.path.isdir(env.output_dir):
        local('rm -rf {output_dir}'.format(**env))
        local('mkdir {output_dir}'.format(**env))


def build():
    local('touch content')
    local('pelican -s {config_dir}/settings.py'
          ' -o {output_dir} {content_dir}'.format(**env))


def rebuild():
    clean()
    build()


def regenerate():
    local('pelican -r -s {config_dir}/settings.py'
          ' -o {output_dir} {content_dir}'.format(**env))


def serve():
    local('cd {output_dir} && python3 -m http.server'.format(**env))


def reserve():
    build()
    serve()


def preview():
    local('pelican -s {config_dir}/production.py'
          ' -o {output_dir} {content_dir}'.format(**env))<commit_msg>Created task for publishing.<commit_after># -*- coding: utf-8 -*-


import os

from fabric.colors import green
from fabric.api import env, local, task, lcd, execute, puts


env.project_dir = os.path.dirname(os.path.realpath(__file__))
env.content_dir = env.project_dir + '/content'
env.output_dir = env.project_dir + '/output'
env.config_dir = env.project_dir + '/config'


def clean():
    if os.path.isdir(env.output_dir):
        local('rm -rf {output_dir}'.format(**env))
        local('mkdir {output_dir}'.format(**env))


def build():
    local('touch content')
    local('pelican -s {config_dir}/settings.py'
          ' -o {output_dir} {content_dir}'.format(**env))


def rebuild():
    clean()
    build()


def regenerate():
    local('pelican -r -s {config_dir}/settings.py'
          ' -o {output_dir} {content_dir}'.format(**env))


def serve():
    local('cd {output_dir} && python3 -m http.server'.format(**env))


def reserve():
    build()
    serve()


def preview():
    local('pelican -s {config_dir}/production.py'
          ' -o {output_dir} {content_dir}'.format(**env))


@task
def publish():
    # build
    execute(build)

    # deploy
    with lcd(env.output_dir):
        # ghp import
        local('ghp-import -p ' + env.output_dir)

    puts(green('Content was published.'))
{'fraction_non_alphanumeric': 0.1746987951807229, 'fraction_numerical': 0.0017211703958691911, 'mean_word_length': 3.2427007299270074, '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': '3452328', 'n_tokens_mistral': 816, 'n_tokens_neox': 779, 'n_words': 170}