forked from zimmerman-team/IATI.cloud
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtasks.py
More file actions
35 lines (28 loc) · 784 Bytes
/
tasks.py
File metadata and controls
35 lines (28 loc) · 784 Bytes
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
import re
from invoke import run, task, env
def get_oipa_port():
"""
Get OIPA ssh port from `vagrant ssh-config` command
"""
result = run('vagrant ssh-config')
for line in result.stdout.split('\n'):
match = re.findall(' Port (?P<port>\d+)', line)
if len(match):
return match[0]
return None
@task
def test():
"""
Run tests
"""
run('./manage.py test --settings OIPA.test_settings --nomigrations')
@task
def serve():
"""
Serve django dev server on localhost:19088
"""
port = get_oipa_port()
if port is None:
print("Can not find OIPA instance port. Abort.")
return
run('vagrant ssh -c "cd /vagrant/OIPA/ && /home/vagrant/.env/bin/python manage.py runserver 0.0.0.0:8000"')