Files
celebright/Makefile
T

47 lines
1.7 KiB
Makefile
Raw Normal View History

2026-09-01 15:37:23 +00:00
.PHONY: deploy clean help setup
# Configuration — override on the command line or in your environment, e.g.
# make deploy REMOTE_HOST=homeassistant.local
REMOTE_HOST ?= homeassistant.local
REMOTE_PATH ?= /homeassistant/custom_components
REMOTE_USER ?= root
LOCAL_PATH = custom_components/celebright
# Default target
help:
@echo "Celebright Home Assistant Integration - Makefile"
@echo ""
@echo "Available targets:"
@echo " make deploy - Deploy integration to Home Assistant (set REMOTE_HOST)"
@echo " make setup - Ensure remote directory exists with correct permissions"
@echo " make clean - Remove Python cache files"
@echo " make help - Show this help message"
@echo ""
@echo "Override REMOTE_HOST / REMOTE_PATH / REMOTE_USER for your own host."
# Ensure remote directory exists with correct permissions
setup:
@echo "Setting up remote directory on $(REMOTE_HOST)..."
@ssh $(REMOTE_HOST) "sudo mkdir -p $(REMOTE_PATH)/celebright && sudo chown -R $(REMOTE_USER):$(REMOTE_USER) $(REMOTE_PATH)/celebright"
@echo "Setup complete!"
# Deploy integration to Home Assistant
deploy: setup
@echo "Deploying Celebright integration to $(REMOTE_HOST)..."
rsync -avz --delete \
--exclude='__pycache__' \
--exclude='*.pyc' \
--exclude='.DS_Store' \
--exclude='*.swp' \
$(LOCAL_PATH)/ $(REMOTE_HOST):$(REMOTE_PATH)/celebright/
@echo ""
@echo "Deployment complete!"
@echo "Remember to restart Home Assistant to load the changes."
# Clean Python cache files
clean:
@echo "Cleaning Python cache files..."
find $(LOCAL_PATH) -type d -name '__pycache__' -exec rm -rf {} + 2>/dev/null || true
find $(LOCAL_PATH) -type f -name '*.pyc' -delete 2>/dev/null || true
@echo "Clean complete!"