Browse Source

Deployment script

master
David Larlet 5 years ago
parent
commit
6f6da392ca
No known key found for this signature in database
2 changed files with 14 additions and 4 deletions
  1. 13
    4
      famille.py
  2. 1
    0
      requirements.txt

+ 13
- 4
famille.py View File

from time import perf_counter from time import perf_counter


import markdown import markdown
import minicli
from jinja2 import Environment as Env from jinja2 import Environment as Env
from jinja2 import FileSystemLoader from jinja2 import FileSystemLoader
from minicli import cli, run, wrap
from usine import connect, run


HERE = Path(".") HERE = Path(".")
FAMILLE = HERE / "famille" FAMILLE = HERE / "famille"
) )




@cli
@minicli.cli
def generate(): def generate():
template = environment.get_template("histoire.html") template = environment.get_template("histoire.html")
page = template.render(chapters=collection()) page = template.render(chapters=collection())
open(FAMILLE / "histoire" / "index.html", "w").write(page) open(FAMILLE / "histoire" / "index.html", "w").write(page)




@wrap
@minicli.cli
def deploy():
repository = "gitea-repositories/davidbgk/larlet-fr-famille.git"
run(f"git archive --remote={repository} master | tar -x -C larlet-fr/famille")
print("Deployment done.")


@minicli.wrap
def perf_wrapper(): def perf_wrapper():
start = perf_counter() start = perf_counter()
yield yield




if __name__ == "__main__": if __name__ == "__main__":
run()
with connect(hostname="larlet@ssh-larlet.alwaysdata.net"):
minicli.run()

+ 1
- 0
requirements.txt View File

Jinja2==2.10.3 Jinja2==2.10.3
Markdown==3.1.1 Markdown==3.1.1
minicli==0.4.4 minicli==0.4.4
usine==0.2.2

Loading…
Cancel
Save