-
Notifications
You must be signed in to change notification settings - Fork 3
/
tasks.py
74 lines (54 loc) · 1.27 KB
/
tasks.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
"""
Invoke - Tasks
==============
"""
from __future__ import annotations
import inspect
if not hasattr(inspect, "getargspec"):
inspect.getargspec = inspect.getfullargspec
from invoke.context import Context
from invoke.tasks import task
__author__ = "Colour Developers"
__copyright__ = "Copyright 2013 Colour Developers"
__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause"
__maintainer__ = "Colour Developers"
__email__ = "[email protected]"
__status__ = "Production"
__all__ = ["clean", "precommit", "build"]
@task
def clean(
ctx: Context,
):
"""
Clean the project.
Parameters
----------
ctx
Context.
"""
print("Cleaning project...")
patterns = ["output", ".doit.db"]
for pattern in patterns:
ctx.run(f"rm -rf {pattern}")
@task
def precommit(ctx: Context):
"""
Run the "pre-commit" hooks on the codebase.
Parameters
----------
ctx
Context.
"""
print('Running "pre-commit" hooks on the codebase...')
ctx.run("pre-commit run --all-files")
@task(precommit)
def build(ctx):
"""
Build the project.
Parameters
----------
ctx : invoke.context.Context
Context.
"""
print("Building...")
ctx.run("nikola build")