-
Notifications
You must be signed in to change notification settings - Fork 2k
/
travis-install-dependencies
executable file
·58 lines (45 loc) · 1.97 KB
/
travis-install-dependencies
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
#!/bin/bash
# Exit immediately if any command fails
set -e
# Drop Travis' postgres cluster if we're building using a different pg version
TRAVIS_PGVERSION='9.1'
if [ $PGVERSION != $TRAVIS_PGVERSION ]
then
echo "##### Drop Travis' postgres cluster as we are not using its postgres version #####"
sudo -u postgres pg_dropcluster --stop $TRAVIS_PGVERSION main
# Make psql use $PGVERSION
export PGCLUSTER=$PGVERSION/main
echo "##### Using PGCLUSTER=$PGCLUSTER #####"
fi
echo "##### Install postgres and solr #####"
sudo apt-get update -qq
sudo apt-get install postgresql-$PGVERSION solr-jetty libcommons-fileupload-java:amd64=1.2.2-1
sudo sed -i -e 's/port = 5433/post = 5432/g' /etc/postgresql/8.4/main/postgresql.conf
echo "##### Restart Postgres #####"
sudo service postgresql restart
echo "##### Setup postgres' users and databases #####"
sudo -u postgres psql -c "CREATE USER ckan_default WITH PASSWORD 'pass';"
sudo -u postgres psql -c "CREATE USER datastore_default WITH PASSWORD 'pass';"
sudo -u postgres psql -c 'CREATE DATABASE ckan_test WITH OWNER ckan_default;'
sudo -u postgres psql -c 'CREATE DATABASE datastore_test WITH OWNER ckan_default;'
echo "##### Install Python requirements #####"
export PIP_USE_MIRRORS=true
pip install -r requirements.txt
pip install -r dev-requirements.txt
echo "##### Run setup.py develop #####"
python setup.py develop
echo "##### Install npm dependencies for mocha #####"
npm install -g mocha-phantomjs phantomjs
echo "##### Init CKAN database #####"
paster db init -c test-core.ini
echo "##### Set up datastore permissions #####"
# If Postgres >= 9.0, we don't need to use datastore's legacy mode.
if [ $PGVERSION != '8.4' ]
then
sed -i -e 's/.*datastore.read_url.*/ckan.datastore.read_url = postgresql:\/\/datastore_default:pass@\/datastore_test/' test-core.ini
paster datastore set-permissions postgres -c test-core.ini
else
sed -i -e 's/.*datastore.read_url.*//' test-core.ini
fi
echo "##### test-core.ini contents #####"
cat test-core.ini