Last active
April 1, 2017 17:17
-
-
Save ggdx/e1399673df9258b5a01e38abff92ca6e to your computer and use it in GitHub Desktop.
Bash script to scaffold new dev projects.
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 -e " \n" | |
echo -e "--------------------------" | |
echo -e "- Create a new project -" | |
echo -e "--------------------------" | |
echo -e " \n" | |
echo -n "Who is the client? " | |
read client | |
if [ ! -d "/srv/http/$client" ]; then | |
mkdir /srv/http/$client | |
fi | |
echo -n "What is the name of your project? " | |
read name | |
if [ -d "/srv/http/$client/$name" ]; then | |
echo "The project $client : $name already exists. " | |
exit | |
fi | |
packages[1]="Wordpress" | |
packages[2]="Laravel" | |
packages[3]="Vue" | |
packages[4]="Empty" | |
packages[5]="Quit" | |
select option in ${packages[@]}; do | |
if [ $option = "Wordpress" ]; then | |
echo "Building environment...." | |
mkdir /srv/http/$client/$name | |
cd /srv/http/$client/$name | |
echo "Downloading Wordpress (Latest)...." | |
wget https://wordpress.org/latest.zip | |
echo "Unpacking...." | |
unzip latest.zip | |
break; | |
elif [ $option = "Laravel" ]; then | |
cd /srv/http/$client | |
echo "Building Laravel environment...." | |
composer create-project laravel/laravel $name | |
elif [ $option = "Vue" ]; then | |
echo "Building environment...." | |
cd /srv/http/$client | |
echo "Building Vue scaffolding...." | |
vue init webpack-simple $name | |
else | |
echo "Building environment...." | |
mkdir /srv/http/$client/$name | |
cd /srv/http/$client/$name | |
fi | |
done | |
echo "Do you need a database?" | |
ifdatabases[1]="Yes" | |
ifdatabases[2]="No" | |
select option in ${ifdatabases[@]}; do | |
if [ $option = "Yes" ]; then | |
echo "Give your new database a name" | |
read dbname | |
mysql -u root --password="Gingerdan" --execute "CREATE DATABASE $dbname;" | |
fi | |
done | |
echo "Done" | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment