]> Raphaƫl G. Git Repositories - airlibre/blob - run
Use google apiclient bundle client and secret env variables
[airlibre] / run
1 #! /bin/sh
2
3 export APP_ENV='dev'
4 export APP_SECRET=`cat /dev/urandom | tr -dc 'A-Za-z0-9+,.:;@_-' | head -c 64`
5 export DATABASE_URL='mysql://db_user:db_password@127.0.0.1:3306/db_name?serverVersion=5.7'
6 export MAILER_DSN='sendmail+smtp://default'
7
8 set -x
9
10 # Ask for a full reset
11 read -p 'Full reset Yes/[No] ?' full
12
13 # Full reset required
14 if [ "$full" = 'Yes' -o "$full" = 'YES' -o "$full" = 'yes' ]; then
15 # Check if we have a rapsys racine
16 if [ -d vendor/rapsys ]; then
17 # Process each remaining git sub directory
18 for i in `ls -d vendor/rapsys/*`; do
19 pushd $i;
20 # Stash modifications if present
21 git stash save;
22 # Set back to HEAD
23 git reset --hard;
24 # Force kick untracked files and directories
25 git clean -fxd;
26 popd;
27 done;
28 fi;
29
30 # Stash modifications if present
31 git stash save;
32 # Set back to HEAD
33 git reset --hard;
34 # Force kick untracked files and directories
35 git clean -fxd;
36
37 # Prune directories
38 sudo rm -fr var/{cache/{dev,prod,test},log,sessions} public/{css,js,img,bundles};
39
40 # Recreate tree
41 mkdir -p var/{cache/{dev,prod,test},log,sessions} public/{css,js,img,bundles};
42
43 # Touch local env
44 touch '.env.local.php'
45
46 # Set ownership
47 chown $USER. '.env.local.php' var/{cache/{,dev,prod,test},log,sessions} public/{,css,js,img,bundles};
48
49 # Set acl
50 setfacl -m u:apache:rwX '.env.local.php' var/{cache/{,dev,prod,test},log,sessions} public/{css,js,img,bundles};
51
52 # Run install
53 composer install --no-scripts
54
55 # Run fix-recipes
56 composer fix-recipes
57
58 # Reset composer.json
59 git checkout -- composer.json
60
61 # Recreate src/Entity for doctrine
62 mkdir -p src/Entity
63
64 # Run scripts as apache
65 sudo -u apache composer auto-scripts
66
67 # Fix env file
68 perl -ne 'my %e=(APP_ENV=>"'$APP_ENV'",APP_SECRET=>"'${APP_SECRET/@/\\@}'",DATABASE_URL=>"'${DATABASE_URL/@/\\@}'",MAILER_DSN=>"'$MAILER_DSN'");my $p=join("|",keys %e);if(/^[#\s]*($p)=/){$_=$1."=\"".$e{$1}."\"\n";};print $_;' -i.orig .env
69
70 # Dump the env
71 sudo -u apache composer symfony:dump-env $APP_ENV
72
73 # Remove acl
74 setfacl -b '.env.local.php'
75
76 # Drop current schema
77 sudo -u apache php bin/console doctrine:schema:drop --force
78
79 # Create current schema
80 sudo -u apache php bin/console doctrine:schema:create
81
82 # Load fixtures
83 sudo -u apache php bin/console doctrine:fixtures:load --env=dev --no-interaction
84
85 # Clear cache again
86 sudo -u apache php bin/console cache:clear
87 else
88 # Prune directories
89 rm -fr var/{cache/{dev,prod,test},log,sessions} public/bundles;
90
91 # Recreate them
92 mkdir -p var/{cache/{dev,prod,test},log,sessions} public/{,bundles/rapsyspack/}{css,js,img};
93
94 # Set ownership
95 sudo chown $USER. var/{cache/{,dev,prod,test},log,sessions} public/{,css,js,img,bundles/{,rapsyspack/{,css,js,img}}};
96
97 # Set acl
98 sudo setfacl -m u:apache:rwX var/{cache/{,dev,prod,test},log,sessions} public/{css,js,img,bundles/{,rapsyspack/{css,js,img}}};
99
100 # Run composer update
101 composer update --no-scripts
102
103 # Run fix-recipes
104 composer fix-recipes
105
106 # Reset composer.json
107 git checkout -- composer.json
108
109 # Prune directories
110 rm -fr var/{cache/{dev,prod,test},log,sessions} public/bundles;
111
112 # Recreate them
113 mkdir -p var/{cache/{dev,prod,test},log,sessions} public/{,bundles/rapsyspack/}{css,js,img};
114
115 # Set ownership
116 sudo chown $USER. var/{cache/{,dev,prod,test},log,sessions} public/{,css,js,img,bundles/{,rapsyspack/{,css,js,img}}};
117
118 # Set acl
119 sudo setfacl -m u:apache:rwX var/{cache/{,dev,prod,test},log,sessions} public/{css,js,img,bundles/{,rapsyspack/{,css,js,img}}};
120
121 # Run scripts as apache
122 sudo -u apache composer auto-scripts
123
124 # Clear cache again
125 sudo -u apache php bin/console cache:clear
126 fi
127
128 # Recreate them
129 mkdir -p var/{cache/{dev,prod,test},log,sessions} public/{,bundles/rapsyspack/}{css,js,img};
130
131 # Set ownership
132 sudo chown $USER. var/{cache/{,dev,prod,test},log,sessions} public/{,css,js,img,bundles/{,rapsyspack/{,css,js,img}}};
133
134 # Set acl
135 setfacl -m u:apache:rwX var/{cache/{,dev,prod,test},log,sessions} public/{css,js,img,bundles/{,rapsyspack/{css,js,img}}};