install.sh 1.03 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" ]
okhin's avatar
okhin committed
11 12
then
    source $HOME/app/env
13 14 15
fi    

cd $HOME
16
git reset --hard
17 18
git pull origin $CI_BUILD_REF_NAME
git checkout $CI_BUILD_REF_NAME
Rémi Oudin's avatar
Rémi Oudin committed
19 20
git submodule init
git submodule update
21 22 23 24 25

composer install --no-dev
composer update

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