Makefile 1.73 KB
Newer Older
1
.PHONY: clean build install dist test_venv test_project
2
VERSION=`python setup.py -V`
3

4 5 6 7 8 9
build:
	python setup.py build

install:
	python setup.py install

Valentin Samir's avatar
Valentin Samir committed
10
clean_pyc:
11 12
	find ./ -name '*.pyc' -delete
	find ./ -name __pycache__ -delete
Valentin Samir's avatar
Valentin Samir committed
13
clean_build:
14
	rm -rf build django_cas_server.egg-info dist
Valentin Samir's avatar
Valentin Samir committed
15 16 17 18 19 20
clean_tox:
	rm -rf .tox
clean_test_venv:
	rm -rf test_venv
clean: clean_pyc clean_build
clean_all: clean_pyc clean_build clean_tox clean_test_venv
21

22 23
dist:
	python setup.py sdist
24

25
test_venv:
26 27
	mkdir -p test_venv
	virtualenv test_venv
28
	test_venv/bin/pip install -U --requirement requirements.txt
29

30
test_venv/cas/manage.py:
31 32
	mkdir -p test_venv/cas
	test_venv/bin/django-admin startproject cas test_venv/cas
33
	ln -s ../../cas_server test_venv/cas/cas_server
34 35 36 37
	sed -i "s/'django.contrib.staticfiles',/'django.contrib.staticfiles',\n    'bootstrap3',\n    'cas_server',/" test_venv/cas/cas/settings.py
	sed -i "s/'django.middleware.clickjacking.XFrameOptionsMiddleware',/'django.middleware.clickjacking.XFrameOptionsMiddleware',\n    'django.middleware.locale.LocaleMiddleware',/" test_venv/cas/cas/settings.py
	sed -i 's/from django.conf.urls import url/from django.conf.urls import url, include/' test_venv/cas/cas/urls.py
	sed -i "s@url(r'^admin/', admin.site.urls),@url(r'^admin/', admin.site.urls),\n    url(r'^', include('cas_server.urls', namespace='cas_server')),@" test_venv/cas/cas/urls.py
38 39
	test_venv/bin/python test_venv/cas/manage.py migrate
	test_venv/bin/python test_venv/cas/manage.py createsuperuser
40

41 42 43 44 45
test_project: test_venv test_venv/cas/manage.py
	@echo "##############################################################"
	@echo "A test django project was created in $(realpath test_venv/cas)"

run_test_server: test_project
46
	test_venv/bin/python test_venv/cas/manage.py runserver