forked from lucyparsons/OpenOversight
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
71 lines (58 loc) · 1.95 KB
/
Makefile
File metadata and controls
71 lines (58 loc) · 1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
default: build start create_db populate test stop clean
.PHONY: build
build: ## Build containers
docker-compose build
.PHONY: start
start: build ## Run containers
docker-compose up -d
.PHONY: create_db
create_db: start
@until docker-compose exec postgres psql -h localhost -U openoversight -c '\l' postgres &>/dev/null; do \
echo "Postgres is unavailable - sleeping..."; \
sleep 1; \
done
@echo "Postgres is up"
## Creating database
docker-compose run --rm web python ../create_db.py
.PHONY: assets
assets:
docker-compose run --rm web yarn build
.PHONY: dev
dev: build start create_db populate
.PHONY: populate
populate: create_db ## Build and run containers
@until docker-compose exec postgres psql -h localhost -U openoversight -c '\l' postgres &>/dev/null; do \
echo "Postgres is unavailable - sleeping..."; \
sleep 1; \
done
@echo "Postgres is up"
## Populate database with test data
docker-compose run --rm web python ../test_data.py -p
.PHONY: test
test: start ## Run tests
if [ -z "$(name)" ]; \
then FLASK_ENV=testing docker-compose run --rm web pytest -n 4 --dist=loadfile -v tests/; \
else FLASK_ENV=testing docker-compose run --rm web pytest -n 4 --dist=loadfile -v tests/ -k $(name); \
fi
.PHONY: cleanassets
cleanassets:
rm -rf ./OpenOversight/app/static/dist/*
.PHONY: stop
stop: ## Stop containers
docker-compose stop
.PHONY: clean
clean: cleanassets stop ## Remove containers
docker-compose rm -f
.PHONY: clean_all
clean_all: clean stop ## Wipe database
rm -rf container_data
.PHONY: docs
docs: ## Build project documentation in live reload for editing
make -C docs/ clean && sphinx-autobuild docs/ docs/_build/html
.PHONY: help
help: ## Print this message and exit
@printf "OpenOversight: Makefile for development, documentation and testing.\n"
@printf "Subcommands:\n\n"
@awk 'BEGIN {FS = ":.*?## "} /^[0-9a-zA-Z_-]+:.*?## / {printf "\033[36m%s\033[0m : %s\n", $$1, $$2}' $(MAKEFILE_LIST) \
| sort \
| column -s ':' -t