"""
Build tasks for Rookeries.

:copyright: Copyright 2013-2017, Dorian Puła
    <dorian.pula@amber-penguin-software.ca>
:license: AGPL v3+
"""

import invoke as inv

from . import app, db, js, server, test


@inv.task
def clean(ctx):
    """
    Cleans out generated assets and bytecode.

    :param ctx: Context of the invoke task.
    """
    inv.run('find . | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf')
    inv.run('rm -rf dist')
    inv.run('rm -rf static/js/*')


ns = inv.Collection()
ns.add_collection(app)
ns.add_collection(db)
ns.add_collection(js)
ns.add_collection(server)
ns.add_collection(test)
ns.add_task(clean)
