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