-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
54 lines (48 loc) · 1.59 KB
/
makefile
File metadata and controls
54 lines (48 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
SHELL := /bin/bash
CURRENT_DIR := $(shell pwd)
INSTALL_PATH := /usr/local/bin/k8dev
.PHONY: install uninstall check test help
help:
@echo "Available commands:"
@echo " make install - Install k8dev command"
@echo " make uninstall - Remove k8dev command"
@echo " make check - Check installation status"
@echo " make test - Run tests"
install:
@echo "Installing k8dev..."
@if [ ! -f $(CURRENT_DIR)/k8dev.sh ]; then \
echo "Error: k8dev.sh not found in current directory"; \
exit 1; \
fi
@chmod +x $(CURRENT_DIR)/k8dev.sh
@if [ -f $(INSTALL_PATH) ]; then \
sudo rm -f $(INSTALL_PATH); \
fi
@sudo ln -sf $(CURRENT_DIR)/k8dev.sh $(INSTALL_PATH)
@echo "k8dev installed successfully!"
@echo "Try 'k8dev help' to get started"
uninstall:
@echo "Uninstalling k8dev..."
@if [ -f $(INSTALL_PATH) ]; then \
sudo rm -f $(INSTALL_PATH); \
echo "k8dev uninstalled successfully!"; \
else \
echo "k8dev is not installed"; \
fi
check:
@echo "Checking k8dev installation..."
@if [ -L $(INSTALL_PATH) ]; then \
echo "Installation path: $(shell readlink -f $(INSTALL_PATH))"; \
echo "Version: $$(k8dev version 2>/dev/null || echo 'unknown')"; \
kubectl version --client || echo "kubectl not found"; \
helm version --client || echo "helm not found"; \
else \
echo "k8dev is not installed"; \
fi
test:
@echo "Running tests..."
@echo "Checking script syntax..."
@bash -n k8dev.sh || exit 1
@echo "Checking for required commands..."
@command -v kubectl >/dev/null 2>&1 || { echo "kubectl not found"; exit 1; }
@command -v helm >/dev/null 2>&1 || { echo "helm not found"; exit 1; }