.PHONY: build clean test lint install docs

VERSION := $(shell grep -E '^version:' galaxy.yml | awk '{print $$2}')

build:
	ansible-galaxy collection build . --force

clean:
	rm -rf dist/ *.egg-info
	find . -type d -name __pycache__ -exec rm -rf {} +

test:
	# Run role tests with ansible-test
	@echo "No tests configured yet"

lint:
	# Lint all YAML files
	yamllint -c .yamllint.yml roles/ playbooks/ || true
	# Lint Ansible code
	--check --playbooks playbooks/

install: build
	ansible-galaxy install dist/*.tar.gz --force

docs:
	# Generate documentation from roles
	--doc roles/ > docs/index.md 2>/dev/null || echo "Documentation not available"

help:
	@echo "Ansible Collection Makefile"
	@echo ""
	@echo "Targets:"
	@echo "  build    - Build the collection tarball"
	@echo "  clean    - Remove build artifacts"
	@echo "  test     - Run tests (not configured)"
	@echo "  lint     - Run linters on roles and playbooks"
	@echo "  install  - Install to local system"
	@echo "  docs     - Generate documentation"
	@echo "  help     - Show this help"
