pre-push commit

This commit is contained in:
Peter van Arkel
2025-11-20 14:40:42 +01:00
parent 3001e5cffd
commit 644b207997
43 changed files with 1681 additions and 0 deletions

29
tasks.py Normal file
View File

@@ -0,0 +1,29 @@
from invoke import task
import webbrowser, os
@task
def install(c):
c.run("python -m pip install -U pip")
c.run("python -m pip install -e . -r requirements-dev.txt")
@task
def run(c, host="0.0.0.0", port=5050, token="changeme", data_dir=""):
extra = f"--data-dir {data_dir}" if data_dir else ""
c.run(f"python -m battleflow.cli --host {host} --port {port} --token {token} {extra}")
@task
def seed_icons(c, host="127.0.0.1", port=5050, token="changeme"):
url = f"http://{host}:{port}/admin/seed_icons?token={token}"
c.run(f"python - <<'PY'\nimport urllib.request; urllib.request.urlopen('{url}', data=b'').read()\nprint('Seeded icons via', '{url}')\nPY")
@task
def test(c):
c.run("pytest -q")
@task
def open_admin(c, host="127.0.0.1", port=5050, token="changeme"):
webbrowser.open(f"http://{host}:{port}/admin?token={token}")
@task
def open_board(c, host="127.0.0.1", port=5050, token="changeme"):
webbrowser.open(f"http://{host}:{port}/board?token={token}")