|
1 | | -.PHONY: test style audit |
| 1 | +.PHONY: test style audit upgrade reinstall |
2 | 2 |
|
| 3 | +# Run all checks |
3 | 4 | test: style audit |
4 | 5 |
|
| 6 | +# Fix style issues |
5 | 7 | style: |
6 | 8 | brew style --fix codegroove-dev/tap |
7 | 9 |
|
| 10 | +# Audit the tap (skip false positive about homebrew-core conflict) |
8 | 11 | audit: |
9 | | - brew audit --except=installed --tap=codegroove-dev/tap |
| 12 | + brew audit --except=installed,token_conflicts --tap=codegroove-dev/tap |
| 13 | + |
| 14 | +# Upgrade review-goose to a new version |
| 15 | +# Usage: make upgrade VERSION=v0.9.7 |
| 16 | +upgrade: |
| 17 | +ifndef VERSION |
| 18 | + $(error VERSION is required. Usage: make upgrade VERSION=v0.9.7) |
| 19 | +endif |
| 20 | + @echo "Upgrading review-goose to $(VERSION)..." |
| 21 | + @# Get the commit SHA for the tag (handles signed/annotated tags) |
| 22 | + @# Try dereferenced commit first (for annotated/signed tags), then fall back to direct ref |
| 23 | + @COMMIT=$$(git ls-remote https://github.com/codeGROOVE-dev/goose.git "$(VERSION)^{}" 2>/dev/null | head -1 | cut -f1); \ |
| 24 | + if [ -z "$$COMMIT" ]; then \ |
| 25 | + echo "Trying lightweight tag..."; \ |
| 26 | + COMMIT=$$(git ls-remote --refs https://github.com/codeGROOVE-dev/goose.git $(VERSION) | head -1 | cut -f1); \ |
| 27 | + fi; \ |
| 28 | + if [ -z "$$COMMIT" ]; then \ |
| 29 | + echo "Error: Could not find tag $(VERSION)"; \ |
| 30 | + exit 1; \ |
| 31 | + fi; \ |
| 32 | + echo "Tag $(VERSION) -> commit $$COMMIT"; \ |
| 33 | + VERSION_NUM=$$(echo $(VERSION) | sed 's/^v//'); \ |
| 34 | + echo "Updating Formula/review-goose.rb..."; \ |
| 35 | + sed -i '' -E "s/tag:[ ]*\"v[0-9]+\.[0-9]+\.[0-9]+\"/tag: \"$(VERSION)\"/" Formula/review-goose.rb; \ |
| 36 | + sed -i '' -E "s/revision:[ ]*\"[a-f0-9]+\"/revision: \"$$COMMIT\"/" Formula/review-goose.rb; \ |
| 37 | + echo "Updating Casks/review-goose.rb..."; \ |
| 38 | + sed -i '' -E "s/version \"[0-9]+\.[0-9]+\.[0-9]+\"/version \"$$VERSION_NUM\"/" Casks/review-goose.rb; \ |
| 39 | + sed -i '' -E "s/revision:[ ]*\"[a-f0-9]+\"/revision: \"$$COMMIT\"/" Casks/review-goose.rb |
| 40 | + @echo "Done. Run 'make test' to lint and 'make reinstall' to test install." |
| 41 | + |
| 42 | +# Copy files to tap location and reinstall cask |
| 43 | +reinstall: |
| 44 | + @echo "Copying files to tap..." |
| 45 | + @cp Formula/review-goose.rb /opt/homebrew/Library/Taps/codegroove-dev/homebrew-tap/Formula/ |
| 46 | + @cp Casks/review-goose.rb /opt/homebrew/Library/Taps/codegroove-dev/homebrew-tap/Casks/ |
| 47 | + @echo "Clearing cache..." |
| 48 | + @rm -rf ~/Library/Caches/Homebrew/Cask/goose* ~/Library/Caches/Homebrew/downloads/*goose* 2>/dev/null || true |
| 49 | + @echo "Removing old app..." |
| 50 | + @rm -rf "/Applications/reviewGOOSE.app" 2>/dev/null || true |
| 51 | + @echo "Installing cask..." |
| 52 | + brew reinstall --cask codegroove-dev/tap/review-goose |
| 53 | + @echo "Verifying version..." |
| 54 | + @"/Applications/reviewGOOSE.app/Contents/MacOS/reviewGOOSE" --version |
0 commit comments