Skip to content

Commit

Permalink
feat: check if make is available
Browse files Browse the repository at this point in the history
  • Loading branch information
sripwoud committed Jul 2, 2024
1 parent ec9ce9f commit 8ae4261
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions .setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,21 @@
set -eu

ORANGE="\033[33m"
RED="\033[31m"
RESET="\033[0m"

log() {
printf "%b\n" "$1"
}

is_bin_locally_available() {
is_make_available() {
if ! command -v make >/dev/null; then
log "${RED}error: make is not available.$RESET\nPlease install ${ORANGE}make$RESET for your OS and run this script again."
return 1
fi
}

is_crate_bin_locally_available() {
crate="$1"
[ -x ".cargo/bin/$crate" ]
}
Expand All @@ -21,7 +29,7 @@ install_local() {

maybe_install_local() {
crate="$1"
if ! is_bin_locally_available "$crate"; then
if ! is_crate_bin_locally_available "$crate"; then
install_local "$crate"
else
log " $ORANGE$crate$RESET already installed locally. Skipping."
Expand Down Expand Up @@ -91,6 +99,7 @@ end_log() {
}

main() {
is_make_available
install_dev_deps
write_hooks
end_log
Expand Down

0 comments on commit 8ae4261

Please sign in to comment.