-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
94 lines (76 loc) · 2.77 KB
/
Makefile
File metadata and controls
94 lines (76 loc) · 2.77 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
.PHONY: style test lint install clean help clean_all tap_all lint_all
# Default formula (customize as needed)
LOCAL_REPO := $(shell pwd)
FORMULA_NAME := toolprint
FORMULA_FILE := ./Formula/$(FORMULA_NAME).rb
LOCAL_FORMULA_PATH := $(LOCAL_REPO)/$(FORMULA_FILE)
FORMULA_VERSION := $(shell grep -m1 'VERSION = "' $(FORMULA_FILE) | sed 's/.*VERSION = "\(.*\)".*/\1/')
BINARY_NAME := toolprint
# Tap configuration
REMOTE_TAP := toolprint/tap
LOCAL_TAP := toolprint/tap-local
help:
@echo "Homebrew Formula Maintenance Commands"
@echo "------------------------------------"
@echo "Current Formula ($(FORMULA_NAME)):"
@echo "make version - Show formula version"
@echo "make sha - Show formula SHA (fetched from NPM registry)"
@echo "make info - Show formula info (using local file)"
@echo "make style - Check formula style"
@echo "make lint - Run style check"
@echo "make tap - Tap this repository locally"
@echo "make install - Install formula from local tap"
@echo "make livecheck - Install from local tap and run livecheck"
@echo "make test - Test install and verify version"
@echo "make clean - Remove local tap and clear Homebrew caches"
version:
@echo "Formula version: $(FORMULA_VERSION)"
update:
./update-version.sh
info:
brew info --formula $(FORMULA_FILE)
unlink:
-brew unlink $(FORMULA_NAME)
clean: unlink
@echo "Cleaning up $(FORMULA_NAME)..."
-brew uninstall $(FORMULA_NAME)
-brew untap $(LOCAL_TAP)
-brew untap $(REMOTE_TAP)
-brew cleanup $(FORMULA_NAME)
find "$(shell brew --cache)" -name "*$(FORMULA_NAME)*" -exec rm -rf {} +
@echo "Homebrew tap removed and caches cleared for $(FORMULA_NAME)"
tap:
@echo "Tapping local repository for $(FORMULA_NAME)..."
brew tap $(LOCAL_TAP) $(LOCAL_REPO)
tap-info:
brew tap-info $(LOCAL_TAP)
install: clean unlink tap
@echo "Installing from local tap..."
brew install --formula $(LOCAL_FORMULA_PATH)
livecheck: install
brew livecheck --formula $(FORMULA_FILE)
style:
@echo "Checking style of $(FORMULA_FILE)..."
@ruby -c $(FORMULA_FILE)
@echo "Syntax check passed"
lint: style
@echo "Linting complete (note: full audit requires formula to be in core tap)"
test: clean install
@echo "Testing installation..."
@echo "Expected version: $(FORMULA_VERSION)"
@echo -n "Installed version: "
@INSTALLED_VERSION=$$($(BINARY_NAME) --version | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+' || echo "unknown"); \
echo $$INSTALLED_VERSION; \
if [ "$$INSTALLED_VERSION" = "$(FORMULA_VERSION)" ]; then \
echo "✅ Version check passed!"; \
else \
echo "❌ Version mismatch!"; \
exit 1; \
fi
# Combined targets
clean_all: clean
@echo "Cleanup completed for both formulas."
tap_all: tap
@echo "Tapping completed for both formulas."
lint_all: lint
@echo "All lint checks completed for both formulas."