-
Notifications
You must be signed in to change notification settings - Fork 20
/
fabfile.py
72 lines (49 loc) · 1.3 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
import logging
from decouple import config
from fabric import task
FOLDER = "public"
FOLDER = FOLDER.strip("/")
logging.basicConfig(level=logging.INFO)
@task
def deploy(c):
AWS_BUCKET_NAME = config("AWS_BUCKET_NAME")
AWS_ACCESS_KEY_ID = config("AWS_ACCESS_KEY_ID")
AWS_SECRET_ACCESS_KEY = config("AWS_SECRET_ACCESS_KEY")
c.run(
"s3cmd sync {}/ s3://{} --acl-public --delete-removed "
"--guess-mime-type --access_key={} --secret_key={}".format(
FOLDER,
AWS_BUCKET_NAME,
AWS_ACCESS_KEY_ID,
AWS_SECRET_ACCESS_KEY,
)
)
@task
def test(c):
c.run("python runtests.py")
@task
def coverage(c):
c.run("py.test --cov-report= --cov=rest_framework_ccbv tests/")
@task
def runserver(c):
c.run("cd %s && python -m http.server" % FOLDER)
def clean(c):
c.run("rm -f .klasses.json")
c.run("rm -fr %s/*" % FOLDER)
c.run("mkdir -p %s/static" % FOLDER)
def collect_static(c):
c.run("cp -r static %s/" % FOLDER)
@task
def index(c):
from build_tools.index_generator import main
main()
@task
def version(c):
from build_tools.compile_static import main
main(out_folder=FOLDER)
@task
def build(c):
clean(c)
logging.info("collecting statics")
collect_static(c)
c.run("tox -c build.ini")