-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfabfile.py
85 lines (58 loc) · 1.73 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import sys
from fabric.context_managers import prefix
from fabric.decorators import task
from fabric.operations import local
VIRTUALENV = '.py27'
@task(default=True)
def default():
lint_py()
test_py()
lint_js()
test_js()
@task
def setup():
local('npm install')
local('virtualenv --distribute --python=python2.7 {env}'.format(env=VIRTUALENV))
install_requirements()
@task
def install_requirements():
with prefix(_activate_virtual_env()):
local('pip install -r requirements.txt --use-mirrors')
local('pip install -r requirements-test.txt --use-mirrors')
@task
def clean():
local('./build/clean.sh')
@task
def deploy():
local('git push heroku python:master')
@task
def lint_py():
with prefix(_activate_virtual_env()):
local('pylint --rcfile=./build/pylintrc --reports=n features picbois')
@task
def test_py():
with prefix(_activate_virtual_env()):
local('nosetests')
@task
def lint_js():
local('./node_modules/.bin/jshint --verbose --config build/jshintrc client/src')
@task
def test_js():
local('PHANTOMJS_BIN=./node_modules/.bin/phantomjs '
'./node_modules/.bin/karma start --single-run --browsers PhantomJS build/karma.conf.js')
@task
def karma(*args):
local('./node_modules/.bin/karma {command} build/karma.conf.js'.format(command=args[0]))
@task
def run_server():
with prefix(_activate_virtual_env()):
local("python -c 'import picbois; picbois.APP.run(port=8000)'")
@task
def run_client():
with prefix('cd client'):
local('python -m SimpleHTTPServer 5000')
def _activate_virtual_env():
if not hasattr(sys, 'real_prefix'):
return '. {env}/bin/activate'.format(env=VIRTUALENV)
else:
return 'true'