.ONESHELL:

.PHONY: issetup
issetup:
	@[ -f .git/hooks/commit-msg ] || [ ${SKIP_MAKE_SETUP_CHECK} = "true" ] || (echo "You must run 'make setup' first to initialize the repo!" && exit 1)

.PHONY: setup
setup:
	@cp .gitea/conventional_commits/commit-msg .git/hooks/

.PHONY: help
help:             ## Show the help.
	@echo "Usage: make <target>"
	@echo ""
	@echo "Targets:"
	@fgrep "##" Makefile | fgrep -v fgrep

.PHONY: buildrel
buildrel: issetup             ## Format code.
	dotnet build -c Release song_of_the_day.sln

.PHONY: build
build: issetup             ## Format code.
	dotnet build song_of_the_day.sln

.PHONY: publish
publish: issetup             ## Format code.
	dotnet publish -c Release song_of_the_day.sln

.PHONY: fmt
fmt: issetup             ## Format code.
	dotnet format song_of_the_day.sln

.PHONY: lint
lint: issetup            ## Lint code.
	dotnet format --verify-no-changes --verbosity diagnostic song_of_the_day.sln

.PHONY: test
test: issetup            ## Run tests and generate coverage report.
	dotnet test song_of_the_day.sln

.PHONY: clean
clean: issetup           ## Clean unused files.
	dotnet clean song_of_the_day.sln

.PHONY: release
release: issetup         ## Create a new tag for release.
	@./.gitea/conventional_commits/generate-version.sh

.PHONY: docs
docs: issetup            ## Build the documentation.
	@echo "building documentation ..."
	@mkdocs build
	@URL="site/index.html"; xdg-open $$URL || sensible-browser $$URL || x-www-browser $$URL || gnome-open $$URL || open $$URL

# This project has been generated from rochacbruno/python-project-template
# __author__ = 'rochacbruno'
# __repo__ = https://github.com/rochacbruno/python-project-template
# __sponsor__ = https://github.com/sponsors/rochacbruno/
