-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcreatepj
executable file
·70 lines (56 loc) · 1.85 KB
/
createpj
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
#!/bin/bash
#
# Easy way to create a symfony2 project
# Author: Alejandro hurtado <[email protected]>
#
# USE: ./pathtoscript/createpj projectname [subdomain] [mysprojectsfolder]
SCRIPTPATH=`dirname "$(readlink -f $0)"`
#colors in echo
source $SCRIPTPATH/echoc
if [ "$1" == "-h" ]||[ "$1" == "--help" ];then
echoc $green "./pathtoscript/createpj PROJECTNAME [subdomine] [mysprojectsfolder]" "b";echo
echo " PROJECTNAME: The name of the project that you want to create. "
echo " sudomine: Default value in config file."
echo " mysprojectsfolder: The folder path where you puts your projects. Default value in config file."
exit 2
fi
#read vars from config
if [ -f $SCRIPTPATH/config ];then
source $SCRIPTPATH/config
else
echoc $red "Error: Not config File. Rename the config.dst file try again" "b";echo
exit 1
fi
#create vhost (In ubuntu)
sudo $SCRIPTPATH/vhostcreate $1 $EXT $MYPRJ
#hosts file
if ! $SCRIPTPATH/hostexist $1.$EXT; then
echoc $green "*** host $1.$EXT added to the hosts file ***"
sudo bash -c "echo -e '${SERVERIP}\t${1}.$EXT'>>/etc/hosts"
fi
#download and prepare
wget http://symfony.com/download?v=Symfony_Standard${VENDORS}_${SF2VERSION}.tgz -O temp_sf2.tgz
if [ -f temp_sf2.tgz ];then
tar -C $MYPRJ -xf temp_sf2.tgz
rm temp_sf2.tgz
mv $MYPRJ/Symfony $MYPRJ/$1
else
echo $red "Error downloading Symfony!" "b";echo
exit 1
fi
#check if acl is enabled
if [ "$WITHACL" == "YES" ];then
$SCRIPTPATH/chkacl $MYPRJ || exit $?
fi
#the putacl script
$SCRIPTPATH/putacl $USER $MYPRJ/$1/
sudo a2ensite $1.site
sudo /etc/init.d/apache2 reload
echoc $green "Your next steps:";echo
if [ -z "$VENDORS" ];then
echoc $green " cd $MYPRJ/$1/; php bin/vendors install ";echo
fi
echoc $green "Point your browser to";
echoc $green "http://$1.local/config.php" "u";echo
echo
exit 0