mirror of
https://github.com/prurigro/hypothetical.git
synced 2024-11-09 11:16:39 -05:00
Fail with an error if the .env file does not exist
This commit is contained in:
parent
d461aad347
commit
f71236b30d
1 changed files with 8 additions and 1 deletions
9
init.sh
9
init.sh
|
@ -34,10 +34,12 @@ function error {
|
|||
|
||||
# Check for missing dependencies
|
||||
declare -a missing_deps=()
|
||||
|
||||
for dep in "${deps[@]}"; do
|
||||
type -P "$dep" >/dev/null \
|
||||
|| missing_deps=( ${missing_deps[@]} "$dep" )
|
||||
done
|
||||
|
||||
[[ -n "${missing_deps[*]}" ]] && {
|
||||
error "${c_w}missing dependencies ($(
|
||||
for (( x=0; x < ${#missing_deps[@]}; x++ )); do
|
||||
|
@ -47,11 +49,16 @@ done
|
|||
)$c_w)"
|
||||
}
|
||||
|
||||
# Exit with an error if the .env file does not exist
|
||||
[[ -f '.env' ]] \
|
||||
|| error 'The .env file does not exist'
|
||||
|
||||
# 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
|
||||
[[ -n "$1" && "$1" = '--no-artisan' ]] \
|
||||
&& no_artisan=1
|
||||
|
||||
(( ! no_artisan )) && [[ -d vendor ]] && {
|
||||
artisan_down=1
|
||||
|
|
Loading…
Reference in a new issue