diff --git a/components b/components index eeca1073..804c8571 160000 --- a/components +++ b/components @@ -1 +1 @@ -Subproject commit eeca1073cb097cf5e267752b07b9f688d3051bb5 +Subproject commit 804c85718063b8baddfda59ee7315b7a88364fa1 diff --git a/lib/helpers/utils.bash b/lib/helpers/utils.bash index c1930736..9e647473 100644 --- a/lib/helpers/utils.bash +++ b/lib/helpers/utils.bash @@ -163,3 +163,22 @@ _array-dedupe() { _clean-string "$(echo "$*" | tr ' ' '\n' | sort -u | tr '\n' ' ')" "all" } + +# @function __homebrew-check +# @description check the installation ot homebrew +# @return boolean status code success (0) if the function is found or fails otherwise +function _homebrew-check() { + if _binary_exists 'brew'; then + # Homebrew is installed + if [[ "${GAUDI_BASH_HOMEBREW_PREFIX:-unset}" == 'unset' ]]; then + # variable isn't set + GAUDI_BASH_HOMEBREW_PREFIX="$(brew --prefix)" + else + true # Variable is set already, don't invoke `brew`. + fi + else + # Homebrew is not installed: clear variable. + GAUDI_BASH_HOMEBREW_PREFIX= + false # return failure if brew not installed. + fi +} \ No newline at end of file