-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.sh
executable file
·110 lines (97 loc) · 3.12 KB
/
configure.sh
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/bin/bash
needToBeRoot=false
php="php"
phpMac="/usr/local/php5-5.4.16-20130615-025727/bin/php"
if [ "$1" = "-prod" ] ; then
argument="prod"
elif [ "$1" = "-initialSetup" ] ; then
argument="initialSetup"
needToBeRoot=true;
elif [ "$1" = "-clear" ] ; then
argument="clear"
needToBeRoot=true;
elif [ "$1" = "-updateDB" ] ; then
argument="updateDatabase"
elif [ "$1" = "-updateDBForce" ] ; then
argument="updateDatabaseForce"
elif [ "$1" = "-setRights" ] ; then
argument="setRights"
needToBeRoot=true;
elif [ "$1" = "-runTests" ] ; then
argument="runTests"
if [ "$2" = "" ] ; then
echo "You must specify a namespace"
exit 1
fi
elif [ "$1" = "-generateEntities" ] ; then
argument="generateEntities"
if [ "$2" = "" ] ; then
echo "You must specify a namespace"
exit 1
fi
elif [ "$1" = "-createDefaultDirectories" ] ; then
argument="createDefaultDirectories"
else
echo "You must specify at least one argument"
exit 1
fi
if [ "$2" = "-mac" ] ; then
php=$phpMac
fi
if [ "$3" = "-mac" ] ; then
php=$phpMac
fi
if [ "$needToBeRoot" = true ] ; then
if [ "$(id -u)" != "0" ]; then
echo "Sorry, you are not root."
exit 1
fi
fi
if [ "$argument" = "clear" ] ; then
echo "Clearing the cache"
rm -Rf app/cache/*
elif [ "$argument" = "prod" ] ; then
echo "Putting into production mode"
eval $php app/console doctrine:schema:update --force
eval $php app/console cache:clear --env=prod --no-debug
eval $php app/console assets:install web
eval $php app/console assetic:dump web
rm -Rf app/cache/*
elif [ "$argument" = "updateDatabase" ] ; then
echo "Updating database"
eval $php app/console doctrine:schema:update
elif [ "$argument" = "initialSetup" ] ; then
echo "Initial setup"
eval $php composer.phar self-update
eval $php composer.phar install
eval mkdir web/uploads/media
rm -Rf app/cache/*
if [ "$2" = "-mac" ] ; then
chmod +a "www allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs
chmod +a "`whoami` allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs
else
chmod -R 777 app/cache
chmod -R 777 app/logs
fi
chmod -R 777 web/uploads
elif [ "$argument" = "updateDatabaseForce" ] ; then
echo "Updating database using --force option"
eval $php app/console doctrine:schema:update --force
elif [ "$argument" = "generateEntities" ] ; then
echo "Generating entities for namespace: $2"
eval $php app/console doctrine:generate:entities $2
elif [ "$argument" = "runTests" ] ; then
eval phpunit -c app $2
elif [ "$argument" = "createDirectories" ] ; then
eval mkdir web/uploads/media
elif [ "$argument" = "setRights" ] ; then
rm -Rf app/cache/*
if [ "$2" = "-mac" ] ; then
chmod +a "www allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs
chmod +a "`whoami` allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs
else
chmod -R 777 app/cache
chmod -R 777 app/logs
fi
chmod -R 777 web/uploads
fi