forked from lingthio/Flask-User-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fabfile.py
61 lines (46 loc) · 1.29 KB
/
fabfile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# The 'fabfile.py' is used by Fabric and must reside in the application root directory.
from __future__ import with_statement
from fabric.api import *
from fabric.contrib.console import confirm
from contextlib import contextmanager
@task
def update_env():
"""
Install required Python packages using pip and requirements.txt
"""
local('pip install -r requirements.txt')
@task
def reset_db():
"""
Drop all tables, Create empty tables, and populate tables
"""
local('PYTHONPATH=. python app/startup/reset_db.py')
@task
def test():
"""
Run the automated test suite using py.test
"""
local('py.test --tb=short -s tests/')
@task
def test_cov():
"""
Run the automated test suite using py.test
"""
local('py.test --tb=short -s --cov app --cov-config tests/.coveragerc --cov-report term-missing tests/')
@task
def runserver():
"""
Start the web application using a development WSGI webserver provided by Flask
"""
local('python runserver.py')
@task
def deploy():
"""
Deploy web application to Heroku.
Requires: heroku git:remote -a PROJECTNAME
"""
local('git push heroku master')
@contextmanager
def virtualenv(venv_name):
with prefix('source ~/.virtualenvs/'+venv_name+'/bin/activate'):
yield