diff --git a/README.md b/README.md index 91e354b..e3b4df3 100755 --- a/README.md +++ b/README.md @@ -5,9 +5,10 @@ - alembic - camelCase API - py.test (with coverage) +- invoke (CLI) ## Usage -Install requirements +1. Install requirements ``` virtualenv -p python3.6 venv @@ -15,7 +16,7 @@ source venv/bin/activate pip install -r requirements.txt ``` -Adjust `settings.toml` with your `DATABASE_URL` on `common` and `test`. +2. Adjust `settings.toml` with your `DATABASE_URL` on `common` and `test`. For now, `common` represents both production and dev. @@ -35,9 +36,12 @@ alembic revision -m "New thing did" --autogenerate ``` - ### Dev -`export ENVIRONMENT="common" && gunicorn --reload app:app` +``` +$ invoke start +``` ### Test -`export ENVIRONMENT="test" && pytest tests` +``` +$ invoke test --cov --verbose +``` diff --git a/tasks.py b/tasks.py new file mode 100644 index 0000000..dd57851 --- /dev/null +++ b/tasks.py @@ -0,0 +1,18 @@ +from invoke import task + + +@task +def test(c, cov=False, verbose=False): + c.run("export ENVIRONMENT=test") + pytest_command = 'pytest tests' + if cov: + pytest_command += ' --cov=api' + if verbose: + pytest_command += ' -s ' + c.run(pytest_command) + + +@task +def start(c): + c.run("export ENVIRONMENT=common") + c.run('gunicorn --reload app:app')