pre-push commit
This commit is contained in:
29
tasks.py
Normal file
29
tasks.py
Normal 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}")
|
||||
Reference in New Issue
Block a user