makefile 1.48 KB
Newer Older
João Denis Rodrigues's avatar
João Denis Rodrigues committed
1 2 3 4 5
SITE-OWNER = www-data
SITE-OWNER-GROUP = www-data

all:

bhmeyer's avatar
bhmeyer committed
6 7 8 9 10 11 12 13
# The follows commands permit to use manage.py and
# docker-compose up with make. Examples:
# make docker-manage migrate
# make docker-manage makemigrations uploads
# make docker-up --build
%:
	@:
args = `arg="$(filter-out $@,$(MAKECMDGOALS))" && echo $${arg:-${1}}`
João Denis Rodrigues's avatar
João Denis Rodrigues committed
14 15 16 17 18 19 20 21

clean:
	@rm -rf *~ *.pyc *.backup

clean-deploy: clean
	@rm -rf static db.sqlite3

coverage:
22 23
	(cd src; coverage run --source='.' manage.py test; coverage html)
	mv src/htmlcov .
João Denis Rodrigues's avatar
João Denis Rodrigues committed
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38


docs:
	@echo 'ainda não implementado'


deploy:
	python manage.py migrate
	python manage.py collectstatic -v0 --noinput
	chown $(SITE-OWNER):$(SITE-OWNER-GROUP) -R .

clean-docs:
	@rm -rf docs

install:
39 40
	apt-get update -qq
	apt-get install -y python3-dev python3-pip libpq-dev postgresql postgresql-contrib
Jomaro Rodrigues's avatar
Jomaro Rodrigues committed
41 42

install-user:
43
	pip3 install --user -U pip setuptools pipenv==9.0.3
44
	pipenv install
João Denis Rodrigues's avatar
João Denis Rodrigues committed
45 46


47 48 49 50 51 52 53
# TODO: Create the files in docker with $USER owner	
docker-fix:
	chown -R $USER:$USER *

docker-up:
	docker-compose --project-directory . -f docker_scripts/docker-compose.yml -p adega up

54 55 56
docker-production:
	docker-compose --project-directory . -f docker_scripts/docker-production.yml -p adega up

57
docker-remove-all:
bhmeyer's avatar
bhmeyer committed
58
	docker rm adega_web adega_db
59 60 61 62 63 64 65 66 67 68
	docker rmi adega_web


# Maybe this will not works in all OS systems
docker-install:
	apt-get install docker
	apt-get install docker-compose


docker-manage:
69
	@echo $(call args,"")
70
	docker exec -it adega_web bash -c "cd src; python3 manage.py $(call args,'')"  
71 72