Last active
August 29, 2015 14:07
-
-
Save alfredotranchedone/58c35c41b745844832b3 to your computer and use it in GitHub Desktop.
Simple utility to create a fresh Laravel installation. Laravel is required! ;)
This file contains hidden or 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 | |
# set base directory for Laravel apps (WITH trailing slashes) | |
# ex: "/Users/Foo/apache/httpdocs/" | |
BASE_DIR="/PATH/TO/WEBSERVER/" | |
function quit { | |
exit | |
} | |
function start { | |
echo "Please, insert app name : " | |
read LARAVEL_DESTINATION_DIR_NAME | |
if [ "$LARAVEL_DESTINATION_DIR_NAME" ] ; then | |
# check valid name | |
if [[ $LARAVEL_DESTINATION_DIR_NAME =~ ^[A-Za-z0-9_\-]+$ ]]; then | |
# check if destination exists | |
if [ -d "$BASE_DIR$LARAVEL_DESTINATION_DIR_NAME" ]; then | |
echo | |
echo " \"$LARAVEL_DESTINATION_DIR_NAME\" exists! Please, insert another name." | |
echo | |
start | |
else | |
# go to destination directory | |
cd $BASE_DIR | |
# start laravel | |
laravel new $LARAVEL_DESTINATION_DIR_NAME | |
echo "App is ready:" | |
echo " $BASE_DIR$LARAVEL_DESTINATION_DIR_NAME" | |
echo | |
echo "Choose: another installation (N) or quit (Q) ? " | |
read ACTION | |
case $ACTION in | |
[Nn] ) | |
echo | |
start ;; | |
[Qq] ) | |
clear | |
quit ;; | |
esac | |
fi | |
else | |
echo | |
echo "Name contains invalid characters." | |
echo | |
start | |
fi | |
else | |
echo | |
echo "Please, specify a name." | |
echo | |
start | |
fi | |
} | |
clear | |
echo "--------------------------" | |
echo " LARAVEL UTILITY" | |
echo " CREATE NEW APP" | |
echo " v0.1" | |
echo "--------------------------" | |
echo | |
echo | |
echo "This utility will create a fresh Laravel installation" | |
echo | |
start | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment