forked from coto/gae-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fabfile.py
87 lines (66 loc) · 2.81 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
86
87
"""
REQUIREMENTS:
- install pip with distribute (http://packages.python.org/distribute/)
- sudo pip install Fabric
"""
from fabric.api import local
import config
def lang(mode="extract"):
"""
REQUIREMENTS:
- Install before pip with distribute_setup.py (Read the environment setup document)
- sudo pip install babel
- sudo pip install jinja2
HOW TO RUN:
option 1) fab lang
option 2) fab lang:compile
"""
if mode == "compile":
local("pybabel compile -f -d ./locale")
else:
local("pybabel extract -F ./locale/babel.cfg -o ./locale/messages.pot ./ --sort-output --no-location --omit-header")
local("pybabel update -l en_US -d ./locale -i ./locale/messages.pot --previous --ignore-obsolete")
local("pybabel update -l es_ES -d ./locale -i ./locale/messages.pot --previous --ignore-obsolete")
local("pybabel update -l it_IT -d ./locale -i ./locale/messages.pot --previous --ignore-obsolete")
local("pybabel update -l zh_CN -d ./locale -i ./locale/messages.pot --previous --ignore-obsolete")
local("pybabel update -l id_ID -d ./locale -i ./locale/messages.pot --previous --ignore-obsolete")
local("pybabel update -l fr_FR -d ./locale -i ./locale/messages.pot --previous --ignore-obsolete")
local("pybabel update -l de_DE -d ./locale -i ./locale/messages.pot --previous --ignore-obsolete")
local("pybabel update -l ru_RU -d ./locale -i ./locale/messages.pot --previous --ignore-obsolete")
local("pybabel update -l pt_BR -d ./locale -i ./locale/messages.pot --previous --ignore-obsolete")
def start(mode="normal"):
"""
HOW TO RUN:
option 1) fab start
option 2) fab start:clear
"""
if mode == "clear":
local("dev_appserver.py ./ --host 0.0.0.0 --port 8001 --clear_datastore=yes")
else:
local("dev_appserver.py ./ --host 0.0.0.0 --port 8001")
def deploy(app_id=config.app_id, version=config.version):
"""
app.yaml never has to be version:default
HOW TO RUN:
option 1) fab deploy
option 2) fab deploy:preview
option 3) fab deploy:prod
option 4) fab deploy:homo
"""
local("appcfg.py --no_cookies --oauth2 -A {0} -V {1} update .".format(app_id, version))
def test(os="mac"):
"""
REQUIREMENTS:
- install pip with distribute (http://packages.python.org/distribute/)
- sudo pip install mock
- sudo pip install webtest
- sudo pip install pyquery
HOW TO RUN:
option 1) fab test
option 2) fab test:mac
option 3) fab test:linux
"""
path = {
"mac": "/usr/local/google_appengine",
}[os]
local("python testrunner.py {0} ./".format(path))