install.sh 1 KB
Newer Older
1 2
#!/bin/bash
# Ce script est utilisé pour paramétrer l'environnement du site
okhin's avatar
okhin committed
3
if [ "x$PROD_HOME" != "x" ]
okhin's avatar
okhin committed
4
then
5 6 7
    HOME=$PROD_HOME
else
    HOME=/var/www/dons/
okhin's avatar
okhin committed
8
fi
9

okhin's avatar
okhin committed
10
if [ -e "$HOME/app/env" ]
11 12 13 14 15 16
    then
        source $HOME/app/env
    fi
fi    

cd $HOME
17
git reset --hard
18 19
git pull origin $CI_BUILD_REF_NAME
git checkout $CI_BUILD_REF_NAME
Guinness's avatar
Guinness committed
20 21
git submodule init
git submodule update
22 23 24 25 26

composer install --no-dev
composer update

# Let's run the migrations
27
if [ -e "$HOME/phinx.yml" ]
28
then
29
    case $CI_BUILD_REF_NAME in
30
        master)
31
            echo "master"
32
        	php vendor/robmorgan/phinx/bin/phinx migrate -e production;;
33
        preprod)
34
            echo "preprod"
35 36
        	php vendor/robmorgan/phinx/bin/phinx migrate -e development;;
    esac
37
else
38 39 40 41 42 43 44 45
    case $CI_BUILD_REF_NAME in
        master)
            echo "init master"
        	php vendor/robmorgan/phinx/bin/phinx init -e production;;
        preprod)
            echo "init preprod"
        	php vendor/robmorgan/phinx/bin/phinx init -e development;;
    esac
46 47
fi