-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
50 lines (41 loc) · 1.47 KB
/
Makefile
File metadata and controls
50 lines (41 loc) · 1.47 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
.PHONY: lint fmt fmt-check test check version suggest-version install-hooks help
# Default target
help:
@echo "Available targets:"
@echo " lint - Run shellcheck on all .sh files"
@echo " fmt - Format shell files with shfmt"
@echo " fmt-check - Check formatting without modifying"
@echo " test - Run bats tests"
@echo " check - Run lint + fmt-check + test (CI)"
@echo " install-hooks - Install git hooks (symlink from hooks/ to .git/hooks/)"
@echo " version - Show current version from git tag"
@echo " suggest-version - Analyze commits and suggest next version"
# Core targets (used by CI)
lint:
@echo "Running shellcheck..."
@shellcheck cli.sh install.sh uninstall.sh scripts/*.sh
fmt:
@echo "Formatting shell files..."
@shfmt -w -i 0 -ci cli.sh install.sh uninstall.sh scripts/*.sh
fmt-check:
@echo "Checking formatting..."
@shfmt -d -i 0 -ci cli.sh install.sh uninstall.sh scripts/*.sh
test:
@echo "Running tests..."
@bats tests/
check: lint fmt-check test
@echo "All checks passed!"
install-hooks:
@echo "Installing git hooks..."
@mkdir -p .git/hooks
@for hook in hooks/*; do \
hook_name=$$(basename "$$hook"); \
if [ -f ".git/hooks/$$hook_name" ]; then \
rm ".git/hooks/$$hook_name"; \
fi; \
ln -sf "../../$$hook" ".git/hooks/$$hook_name"; \
echo " Installed $$hook_name"; \
done
@echo "Git hooks installed successfully!"
version:
@git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0"