From aa45728590a71d2d181c6124c1be04b5726d7627 Mon Sep 17 00:00:00 2001 From: JGAntunes Date: Tue, 19 Nov 2024 15:51:31 +0000 Subject: [PATCH] chore: create dev-deps script --- Makefile | 12 ++++++------ dev/scripts/dev-deps.sh | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+), 6 deletions(-) create mode 100755 dev/scripts/dev-deps.sh diff --git a/Makefile b/Makefile index ac2ab853ff..8e03a180b9 100644 --- a/Makefile +++ b/Makefile @@ -90,16 +90,16 @@ mock: mockgen -source=pkg/handlers/interface.go -destination=pkg/handlers/mock/mock.go mockgen -source=pkg/operator/client/client_interface.go -destination=pkg/operator/client/mock/mock.go -.PHONY: install-gomplate -install-gomplate: - go install github.com/hairyhenderson/gomplate/v4/cmd/gomplate@latest +.PHONY: dev-deps +dev-deps: + @dev/scripts/dev-deps.sh .PHONY: dev -dev: install-gomplate +dev: dev-deps @dev/scripts/dev.sh .PHONY: %-up -%-up: install-gomplate +%-up: dev-deps @dev/scripts/up.sh $* .PHONY: %-down @@ -107,7 +107,7 @@ dev: install-gomplate @dev/scripts/down.sh $* .PHONY: %-up-ec -%-up-ec: install-gomplate +%-up-ec: dev-deps @dev/scripts/up-ec.sh $* .PHONY: %-down-ec diff --git a/dev/scripts/dev-deps.sh b/dev/scripts/dev-deps.sh new file mode 100755 index 0000000000..2825e66a9a --- /dev/null +++ b/dev/scripts/dev-deps.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +set -e + +function is_not_in_path() { + if ! which "$1" > /dev/null; then + echo "$1 is not installed" + return 0 + fi + return 1 +} + +function check_gomplate() { + if is_not_in_path gomplate; then + echo "gomplate is not installed. Installing it now." + go install github.com/hairyhenderson/gomplate/v4/cmd/gomplate@latest + fi +} + +check_gomplate