-
Notifications
You must be signed in to change notification settings - Fork 2k
/
travis.py
executable file
·37 lines (26 loc) · 1.07 KB
/
travis.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
#!/usr/bin/env python
import os
import sys
import subprocess
PG_VERSION = os.environ.get('PGVERSION')
PYTHON_2_6 = sys.version_info < (2, 7)
def shell(arg, split_on='~'):
''' pass a list or arg string that will be split on separator. '''
# FIXME we should raise errors when we have them.
if isinstance(arg, basestring):
arg = arg.split(split_on)
subprocess.call(arg)
# Install postgres and solr
# We need this ppa so we can install postgres-8.4
shell('sudo~add-apt-repository~-yy~ppa:pitti/postgresql')
shell('sudo~apt-get~update~-qq')
shell('sudo~apt-get~install~solr-jetty~postgresql-%s' % PG_VERSION)
sql = "CREATE USER ckanuser WITH PASSWORD 'pass';"
shell('sudo~-u~postgres~psql~-c~%s' % sql)
sql = "CREATE USER readonlyuser WITH PASSWORD 'pass';"
shell('sudo~-u~postgres~psql~-c~%s' % sql)
sql = "CREATE DATABASE ckan_test WITH OWNER ckanuser;"
shell('sudo~-u~postgres~psql~-c~%s' % sql)
sql = "CREATE DATABASE ckan_test_datastore WITH OWNER ckanuser;"
shell('sudo~-u~postgres~psql~-c~%s' % sql)
shell('psql~-U~ckanuser~ckan_test~-c~SELECT version();')