From 1f10f1a8ca5266865e7f8e3b15380ce403dde965 Mon Sep 17 00:00:00 2001 From: Kevin MacMartin Date: Wed, 12 Oct 2016 21:24:14 -0400 Subject: [PATCH] Add --no-artisan command to the init.sh script so it can be run outside homestead without issues --- init.sh | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/init.sh b/init.sh index 09c6e94..837619d 100755 --- a/init.sh +++ b/init.sh @@ -3,6 +3,10 @@ # dependencies deps=('bower' 'composer' 'egrep' 'gulp' 'npm' 'php' 'sed') +# default settings +no_artisan=0 +artisan_down=0 + # Colour scheme [[ -t 1 ]] && { c_d=$'\e[1;30m' # DARK GREY @@ -44,13 +48,16 @@ done # Exit with an error on ctrl-c trap 'error "script killed"' SIGINT SIGQUIT +# Check for the --no-artisan argument and set a flag that prevents artisan commands from being run if present +[[ -n "$1" && "$1" = '--no-artisan' ]] && no_artisan=1 + [[ ! -f .env ]] && { msg "Copying ${c_y}.env.example$c_w to ${c_y}.env$c_w with a randomly generated ${c_g}APP_KEY" - sed 's|^APP_KEY=.*|APP_KEY='"$( .env + sed 's|^APP_KEY=.*|APP_KEY='"$(tr -dc A-Za-z0-9 .env exit } -[[ -d vendor ]] && { +(( ! no_artisan )) && [[ -d vendor ]] && { artisan_down=1 msg "Running: ${c_m}php artisan down" php artisan down @@ -65,10 +72,12 @@ egrep -q '^CACHE_BUST=' .env || { } msg "Updating ${c_y}CACHE_BUST$c_w variable" -sed -i 's|^CACHE_BUST=.*|CACHE_BUST='"$(