forked from python/pythondotorg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtasks.py
47 lines (33 loc) · 1.08 KB
/
tasks.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
import os
import invoke
BASE_DIR = os.path.dirname(__file__)
env = {
'host': 'virt-l4es2w.psf.osuosl.org',
'python': '/srv/redesign.python.org/shared/env/bin/python',
'deploydir': '/srv/redesign.python.org/current',
}
def run(cmd, **kwargs):
"""
Wrapper around invoke.run to automatically interpolate env.
"""
return invoke.run(cmd.format(**dict(env, **kwargs)))
@invoke.task
def chef():
run('ssh {host} sudo chef-client')
@invoke.task
def django(c):
run('ssh {host} sudo {python} {deploydir}/manage.py {c} --settings pydotorg.settings.staging', c=c)
@invoke.task
def copy_data_from_staging(keep=False):
run('curl -s -o staging.json https://preview.python.org/__secret/devfixture/')
run('python manage.py loaddata staging.json')
if not keep:
run('rm -f staging.json')
@invoke.task
def clear_pycs():
""" Remove all .pyc files from project directory """
run("""find {} -name "*.pyc" -delete""".format(BASE_DIR))
@invoke.task
def load_fixtures():
"""Load all fixture files."""
run('./manage.py loaddata fixtures/*.json')