MINIMUM_ARGS=1
E_BADARGS=65
#bash_scripts/newLaravelApp.sh
#Use to clear existing folder completely
rm -rfI * .env* .git*
#git config --global user.name "Johan Meyer"
#git config --global user.email y-core@outlook.com
#
# If git-flow is not installed on the homestead box
#
# [Try either]
# sudo apt-get install git-flow
#
# [Or]
# wget -q – http://github.com/nvie/gitflow/raw/develop/contrib/gitflow-installer.sh –no-check-certificate
# sudo chmod a+x gitflow-installer.sh
# sudo ./gitflow-installer.sh
#check if args are specified
if [ $# -lt $MINIMUM_ARGS ]; then
echo "Usage: $0 <Owner/repository> - example: $0 Yzone/strava "
exit $E_BADARGS
fi
git init
# git remote add origin https://bitbucket.org/$1.git
git remote add origin https://github.com/$1.git
#git remote add -t master -f framework https://github.com/laravel/laravel.git
#the -f option above fetches automatically
git remote add -t master framework https://github.com/laravel/laravel.git
git fetch framework
git checkout -b laravel --track framework/master
git checkout -b master
git flow init -d
git checkout develop
composer install -o
cp .env.example .env
php artisan key:generate
echo "--------------------------------------------------------------------------"
echo " Setup of net Laravel App complete "
echo "--------------------------------------------------------------------------"
echo "- Added repository https://github.com/$1 as branch [master] "
echo "- Added repository https://github.com/laravel/laravel as branch [laravel]"
echo ""
echo "- Initialized git flow "
echo ""
echo "- Installed composer "
echo "- Generated artisan:key "
echo "--------------------------------------------------------------------------"
echo " Next Steps "
echo "--------------------------------------------------------------------------"
echo " - Add existing local repository to Sourcetree "
echo " - Push updates to remote repository "
echo "--------------------------------------------------------------------------"
php artisan key:generate
Update the README.MD file with the application readme content
#bash_scripts/sqlCreate.sh
BTICK='`'
EXPECTED_ARGS=3
E_BADARGS=65
MYSQL="/usr/bin/mysql"
Q1="CREATE DATABASE IF NOT EXISTS ${BTICK}$1${BTICK};"
Q2="GRANT ALL PRIVILEGES ON ${BTICK}$1${BTICK}.* TO '$2'@'%' IDENTIFIED BY '$3' WITH GRANT OPTION;";
Q3="FLUSH PRIVILEGES;"
Q4="SHOW SCHEMAS;"
Q5="SELECT USER,HOST FROM mysql.user;"
Q6="SHOW GRANTS FOR $2;"
SQL="${Q1}${Q2}${Q3}${Q4}${Q5}${Q6}"
if [ $# -ne $EXPECTED_ARGS ]
then
echo "Usage: $0 dbname dbuser dbpass"
exit $E_BADARGS
fi
$MYSQL -uroot -p -e "$SQL"
Once database is created, update the .env file with the database credentials
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
php artisan make:auth
php artisan migrate