Files
encounterflow/tasks.py

30 lines
1003 B
Python
Raw Normal View History

2025-11-20 14:40:42 +01:00
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 ""
2025-11-20 16:55:03 +01:00
c.run(f"python -m encounterflow.cli --host {host} --port {port} --token {token} {extra}")
2025-11-20 14:40:42 +01:00
@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}")