.PHONY: formula deploy-homebrew homebrew

TAP_REPO := https://github.com/jakekara/homebrew-tap.git
TAP_DIR := /tmp/homebrew-tap

# Regenerate the Homebrew formula from PyPI metadata
formula:
	python homebrew/generate_formula.py > homebrew/bye-cloud.rb

# Deploy the formula to the homebrew-tap repo
deploy-homebrew: formula
	rm -rf $(TAP_DIR)
	git clone $(TAP_REPO) $(TAP_DIR)
	mkdir -p $(TAP_DIR)/Formula
	cp homebrew/bye-cloud.rb $(TAP_DIR)/Formula/
	cd $(TAP_DIR) && git add Formula/bye-cloud.rb && \
		git commit -m "update bye-cloud formula" && \
		git push
	rm -rf $(TAP_DIR)

# Full pipeline: generate formula and deploy
homebrew: deploy-homebrew
