2021-09-29 13:07:27 +03:00
|
|
|
DC := $(shell command -v docker-compose 2> /dev/null)
|
|
|
|
ifeq (DC,)
|
2018-10-30 22:44:11 +03:00
|
|
|
DC = $(shell which docker-compose)
|
2021-09-29 13:07:27 +03:00
|
|
|
else
|
|
|
|
DC = $(shell which docker) compose
|
|
|
|
endif
|
2018-10-30 22:44:11 +03:00
|
|
|
|
|
|
|
default: help
|
|
|
|
@echo ""
|
|
|
|
@echo "You need to specify a subcommand."
|
|
|
|
@exit 1
|
|
|
|
|
|
|
|
help:
|
|
|
|
@echo "build - build docker images for dev"
|
2023-11-23 15:10:21 +03:00
|
|
|
@echo "start - docker-compose up the entire system for dev"
|
2018-10-30 22:44:11 +03:00
|
|
|
@echo ""
|
2019-11-21 22:22:33 +03:00
|
|
|
@echo "init - initialize the database and install Node packages"
|
2018-10-30 22:44:11 +03:00
|
|
|
@echo "djshell - start a Django Python shell (ipython)"
|
2023-11-10 00:33:32 +03:00
|
|
|
@echo "dbshell - start a PostgreSQL shell"
|
2018-10-30 22:44:11 +03:00
|
|
|
@echo "shell - start a bash shell"
|
|
|
|
@echo "runshell - start a bash shell with ports bound so you can run the server"
|
|
|
|
@echo "clean - remove all build, test, coverage and Python artifacts"
|
2021-12-07 14:57:44 +03:00
|
|
|
@echo "rebuild - force a rebuild of the dev docker image"
|
2023-11-23 15:18:10 +03:00
|
|
|
@echo "format - format source files"
|
2021-12-07 14:57:44 +03:00
|
|
|
@echo "lint - run pre-commit hooks"
|
|
|
|
@echo "test - run python tests"
|
|
|
|
@echo "test-js - run js tests"
|
2018-10-30 22:44:11 +03:00
|
|
|
@echo "docs - generate Sphinx HTML documentation"
|
|
|
|
|
|
|
|
.env:
|
2023-11-23 15:10:03 +03:00
|
|
|
@echo "Copying .env-dist to .env...";
|
|
|
|
cp -n .env-dist .env;
|
2018-10-30 22:44:11 +03:00
|
|
|
|
2023-11-23 15:10:03 +03:00
|
|
|
.docker-build: .env
|
2018-10-30 22:44:11 +03:00
|
|
|
${MAKE} build
|
|
|
|
|
2021-12-07 14:57:44 +03:00
|
|
|
build:
|
2021-12-29 15:45:21 +03:00
|
|
|
${DC} build web
|
2018-10-30 22:44:11 +03:00
|
|
|
touch .docker-build
|
|
|
|
|
|
|
|
rebuild: clean build
|
|
|
|
|
2023-11-23 15:10:21 +03:00
|
|
|
start: .docker-build
|
2018-10-30 22:44:11 +03:00
|
|
|
${DC} up web
|
2023-11-23 15:10:21 +03:00
|
|
|
run: start
|
2018-10-30 22:44:11 +03:00
|
|
|
|
2021-12-07 14:57:44 +03:00
|
|
|
init: .docker-build
|
2018-10-30 22:44:11 +03:00
|
|
|
${DC} run web bin/run-bootstrap.sh
|
|
|
|
|
2024-05-03 00:14:02 +03:00
|
|
|
init-mac: .docker-build
|
|
|
|
${DC} run web bin/run-bootstrap.sh --optipng-fix
|
|
|
|
|
2021-12-07 14:57:44 +03:00
|
|
|
shell: .docker-build
|
2018-10-30 22:44:11 +03:00
|
|
|
${DC} run web bash
|
|
|
|
|
2021-12-07 14:57:44 +03:00
|
|
|
runshell: .docker-build
|
2018-10-30 22:44:11 +03:00
|
|
|
${DC} run --service-ports web bash
|
|
|
|
|
2021-12-07 14:57:44 +03:00
|
|
|
djshell: .docker-build
|
2018-10-30 22:44:11 +03:00
|
|
|
${DC} run web python manage.py shell
|
|
|
|
|
2021-12-07 14:57:44 +03:00
|
|
|
dbshell: .docker-build
|
2018-10-30 22:44:11 +03:00
|
|
|
${DC} run web python manage.py dbshell
|
|
|
|
|
|
|
|
clean:
|
|
|
|
# python related things
|
|
|
|
find . -name '*.pyc' -exec rm -f {} +
|
|
|
|
find . -name '*.pyo' -exec rm -f {} +
|
|
|
|
find . -name '__pycache__' -exec rm -rf {} +
|
|
|
|
# test related things
|
|
|
|
-rm -f .coverage
|
|
|
|
# docs files
|
|
|
|
-rm -rf docs/_build/
|
|
|
|
# state files
|
|
|
|
-rm -f .docker-build*
|
|
|
|
# node stuff
|
2019-11-21 22:22:33 +03:00
|
|
|
-rm -rf node_modules
|
2018-10-30 22:44:11 +03:00
|
|
|
|
2021-12-07 14:57:44 +03:00
|
|
|
lint: .docker-build
|
|
|
|
${DC} run web pre-commit run --all-files
|
2018-10-30 22:44:11 +03:00
|
|
|
|
2023-11-23 15:18:10 +03:00
|
|
|
format: .docker-build
|
|
|
|
${DC} run web black kitsune/
|
|
|
|
|
2021-12-07 14:57:44 +03:00
|
|
|
test: .docker-build
|
|
|
|
${DC} run web ./bin/run-unit-tests.sh
|
2018-10-30 22:44:11 +03:00
|
|
|
|
2021-12-07 14:57:44 +03:00
|
|
|
test-js: .docker-build
|
2021-12-16 17:53:52 +03:00
|
|
|
${DC} run web npm run webpack:test
|
2018-10-30 22:44:11 +03:00
|
|
|
|
2021-12-07 14:57:44 +03:00
|
|
|
docs: .docker-build
|
2018-10-30 22:44:11 +03:00
|
|
|
${DC} run web $(MAKE) -C docs/ clean
|
|
|
|
${DC} run web $(MAKE) -C docs/ html
|
|
|
|
|
2023-11-23 15:18:10 +03:00
|
|
|
.PHONY: build rebuild run init shell runshell djshell clean lint format test test-js docs
|