From 75380508269140f2d1f54b8fb06a7520cdd50a69 Mon Sep 17 00:00:00 2001 From: purple Date: Mon, 11 Sep 2023 16:23:49 +0200 Subject: [PATCH] Test better "missing dependencies" layout. --- blueprint.sh | 79 +++++++++++++++++++++------------------------------- 1 file changed, 32 insertions(+), 47 deletions(-) diff --git a/blueprint.sh b/blueprint.sh index 4a9b4b4..e842cb4 100644 --- a/blueprint.sh +++ b/blueprint.sh @@ -141,60 +141,45 @@ quit_red() { log_red "$1"; exit 1; } depend() { # Check for required dependencies. - if ! [ -x "$(command -v unzip)" ]; then - log_red '[FATAL] Required dependency "unzip" is not installed or detected.' >&2 - DEPEND_MISSING=true - fi; if ! [ -x "$(command -v node)" ]; then - log_red '[FATAL] Required dependency "node" is not installed or detected.' >&2 - DEPEND_MISSING=true - fi; if ! [ -x "$(command -v yarn)" ]; then - log_red '[FATAL] Required dependency "yarn" is not installed or detected.' >&2 - DEPEND_MISSING=true - fi; if ! [ -x "$(command -v zip)" ]; then - log_red '[FATAL] Required dependency "zip" is not installed or detected.' >&2 - DEPEND_MISSING=true - fi; if ! [ -x "$(command -v curl)" ]; then - log_red '[FATAL] Required dependency "curl" is not installed or detected.' >&2 - DEPEND_MISSING=true - fi; if ! [ -x "$(command -v sed)" ]; then - log_red '[FATAL] Required dependency "sed" is not installed or detected.' >&2 - DEPEND_MISSING=true - fi; if ! [ -x "$(command -v php)" ]; then - log_red '[FATAL] Required dependency "php" is not installed or detected.' >&2 - DEPEND_MISSING=true - fi + if ! [ -x "$(command -v unzip)" ]; then DEPEND_MISSING=true; fi + if ! [ -x "$(command -v node) " ]; then DEPEND_MISSING=true; fi + if ! [ -x "$(command -v yarn) " ]; then DEPEND_MISSING=true; fi + if ! [ -x "$(command -v zip) " ]; then DEPEND_MISSING=true; fi + if ! [ -x "$(command -v curl) " ]; then DEPEND_MISSING=true; fi + if ! [ -x "$(command -v sed) " ]; then DEPEND_MISSING=true; fi + if ! [ -x "$(command -v php) " ]; then DEPEND_MISSING=true; fi # End process when using an older Node.JS version. nodeVer=$(node -v) - if [[ $nodeVer != "v17."* ]] && - [[ $nodeVer != "v18."* ]] && - [[ $nodeVer != "v19."* ]] && - [[ $nodeVer != "v20."* ]] && - [[ $nodeVer != "v21."* ]]; then - log_red '[FATAL] Required dependency "node" is an unsupported version.' >&2 - DEPEND_MISSING=true - fi + if [[ $nodeVer != "v17."* ]] && [[ $nodeVer != "v18."* ]] && [[ $nodeVer != "v19."* ]] && [[ $nodeVer != "v20."* ]] && [[ $nodeVer != "v21."* ]]; then DEPEND_MISSING=true; fi # Check for internal dependencies. - if [[ $LIB__bash_colors ]]; then - log_red '[FATAL] Internal dependency "bash_colors" is not installed or detected.' >&2 - DEPEND_MISSING=true - fi; if [[ $LIB__parse_yaml ]]; then - log_red '[FATAL] Internal dependency "parse_yaml" is not installed or detected.' >&2 - DEPEND_MISSING=true - fi; if [[ $LIB__db ]]; then - log_red '[FATAL] Internal dependency "db" is not installed or detected.' >&2 - DEPEND_MISSING=true - fi; if [[ $LIB__telemetry ]]; then - log_red '[FATAL] Internal dependency "telemetry" is not installed or detected.' >&2 - DEPEND_MISSING=true - fi; if [[ $LIB__updateAdminCacheReminder ]]; then - log_red '[FATAL] Internal dependency "updateAdminCacheReminder" is not installed or detected.' >&2 - DEPEND_MISSING=true - fi + if [[ $LIB__bash_colors ]]; then DEPEND_MISSING=true; fi + if [[ $LIB__parse_yaml ]]; then DEPEND_MISSING=true; fi + if [[ $LIB__db ]]; then DEPEND_MISSING=true; fi + if [[ $LIB__telemetry ]]; then DEPEND_MISSING=true; fi + if [[ $LIB__updateAdminCacheReminder ]]; then DEPEND_MISSING=true; fi # Exit when missing dependencies. - if [[ $DEPEND_MISSING == true ]]; then exit 1; fi + if [[ $DEPEND_MISSING == true ]]; then + log_red "[FATAL] Blueprint found errors for the following dependencies:" + + log_red " - \"node\" ($nodeVer) is an unsupported version." + + log_red " - \"unzip\" is not installed or detected." + log_red " - \"node\" is not installed or detected." + log_red " - \"yarn\" is not installed or detected." + log_red " - \"zip\" is not installed or detected." + log_red " - \"curl\" is not installed or detected." + log_red " - \"sed\" is not installed or detected." + log_red " - \"php\" is not installed or detected." + + log_red " - \"internal:bash_colors\" is not installed or detected." + log_red " - \"internal:parse_yaml\" is not installed or detected." + log_red " - \"internal:db\" is not installed or detected." + log_red " - \"internal:telemetry\" is not installed or detected." + log_red " - \"internal:updateAdminCacheReminder\" is not installed or detected." + fi }