diff --git a/Makefile b/Makefile index 988ac2c..72f2058 100644 --- a/Makefile +++ b/Makefile @@ -1,20 +1,49 @@ -# Minimal makefile for Sphinx documentation -# - -# You can set these variables from the command line, and also -# from the environment for the first two. +# Variables SPHINXOPTS ?= SPHINXBUILD ?= sphinx-build SOURCEDIR = docs/source BUILDDIR = docs/_build -# Put it first so that "make" without argument is like "make help". +.PHONY: help help: @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + @echo "Additional Commands:" + @echo " make test - Run all tests in 'tests/' with pytest" + @echo " make lint - Run ruff linter and auto-fix issues" + @echo " make docs - Generate documentation (same as 'make html')" + @echo " make clean_docs - Remove generated docs" + @echo " make docker-run - Run the Docker container" -.PHONY: help Makefile +.PHONY: test +test: + @echo "Running tests..." + @pytest tests --disable-warnings -# Catch-all target: route all unknown targets to Sphinx using the new -# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +.PHONY: lint +lint: + @echo "Linting with ruff..." + @ruff check --fix . + +.PHONY: docs +docs: + @echo "Building documentation..." + @$(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(BUILDDIR)" + +.PHONY: clean_docs +clean_docs: + @echo "Cleaning up generated documentation files..." + @$(SPHINXBUILD) -M clean "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + @rm -rf "$(SOURCEDIR)/autoapi/" "$(SOURCEDIR)/modules/autogen/" + @echo "Cleanup complete." + + +# Run Docker with default settings +.PHONY: docker-run +docker-run: + @echo "Running Auto Archiver Docker container..." + @docker run --rm -v $PWD/secrets:/app/secrets -v $PWD/local_archive:/app/local_archive bellingcat/auto-archiver + +# Catch-all for Sphinx commands +.PHONY: Makefile %: Makefile @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)