Skip to content

Instantly share code, notes, and snippets.

@ggdx
Last active April 1, 2017 17:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ggdx/e1399673df9258b5a01e38abff92ca6e to your computer and use it in GitHub Desktop.
Save ggdx/e1399673df9258b5a01e38abff92ca6e to your computer and use it in GitHub Desktop.
Bash script to scaffold new dev projects.
#!/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