-
Notifications
You must be signed in to change notification settings - Fork 4
/
run.py
52 lines (36 loc) · 1.16 KB
/
run.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
# -*- coding: utf-8 -*-
"""
.. module:: facio.run
:synopsis: Runs the Facio template process.
"""
import os
from facio.base import BaseFacio
from facio.config import Settings, CommandLineInterface, ConfigurationFile
from facio.pipeline import Pipeline
from facio.template import Template
from facio.state import state
class Run(BaseFacio):
def run(self):
""" Run the Facio processes. """
interface = CommandLineInterface()
interface.start()
config = ConfigurationFile()
parsed = config.read()
settings = Settings(interface, parsed)
state.update_context_variables(settings.get_variables())
template = Template(
settings.get_template_path()
)
template.update_ignore_globs(settings.get_ignore_globs())
template.copy()
pipeline = Pipeline()
pipeline.load(os.path.join(
state.get_project_root(), '.facio.hooks.yml'
))
if pipeline.has_before():
pipeline.run_before()
template.rename()
template.write()
if pipeline.has_after():
pipeline.run_after()
self.success('Done')