Last active
December 24, 2015 18:59
-
-
Save matteocaberlotto/6847198 to your computer and use it in GitHub Desktop.
a bash script to automate symfony 2 project creation (composer, vhost and local dns)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "Enter project name" | |
read PROJECT | |
DIRECTORY="/Users/teito/workspace/$PROJECT" | |
VHOST="/etc/apache2/extra/vhosts/$PROJECT.conf" | |
if [ -d "$DIRECTORY" ]; then | |
echo "Directory already exists" | |
exit 1 | |
fi | |
if [ -f "$VHOST" ]; then | |
echo "Vhost file already exists" | |
exit 1 | |
fi | |
echo "127.0.0.1 $PROJECT.dev" | sudo tee -a /etc/hosts | |
echo " | |
<Virtualhost *> | |
Servername $PROJECT.dev | |
DocumentRoot $DIRECTORY/web | |
<Directory $DIRECTORY/web> | |
AllowOverride All | |
</Directory> | |
</Virtualhost> | |
" | sudo tee "$VHOST" | |
php ~/bin/composer.phar create-project symfony/framework-standard-edition $PROJECT 2.4.0 | |
cd $DIRECTORY | |
rm -rf app/cache/* | |
rm -rf app/logs/* | |
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment