Skip to content

Commit

Permalink
setup invoke tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
dternyak committed Sep 30, 2018
1 parent 2507333 commit 4a33a79
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@
- alembic
- camelCase API
- py.test (with coverage)
- invoke (CLI)

## Usage
Install requirements
1. Install requirements

```
virtualenv -p python3.6 venv
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.

Expand All @@ -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
```
18 changes: 18 additions & 0 deletions tasks.py
Original file line number Diff line number Diff line change
@@ -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')

0 comments on commit 4a33a79

Please sign in to comment.