Add a run_test_server target to make file

running make run_test_server will build a virtualenv, create a django projet
with django-cas-server and lauch ./management.py runserver
This commit is contained in:
Valentin Samir 2015-12-17 14:44:06 +01:00
parent 7b4fac5754
commit e832a93b39
2 changed files with 26 additions and 1 deletions

1
.gitignore vendored
View file

@ -9,3 +9,4 @@ db.sqlite3
manage.py manage.py
.tox .tox
test_venv

View file

@ -1,4 +1,6 @@
.PHONY: clean build install dist .PHONY: clean build install dist test_venv
VERSION=0.4
build: build:
python setup.py build python setup.py build
@ -10,5 +12,27 @@ clean:
find ./ -name __pycache__ -delete find ./ -name __pycache__ -delete
rm -rf build django_cas_server.egg-info dist rm -rf build django_cas_server.egg-info dist
clean_all: clean
rm -rf test_venv .tox
dist: dist:
python setup.py sdist python setup.py sdist
test_venv: dist
mkdir -p test_venv
virtualenv test_venv
test_venv/bin/pip install -U django-cas-server ./dist/django-cas-server-${VERSION}.tar.gz
test_venv/cas:
mkdir -p test_venv/cas
test_venv/bin/django-admin startproject cas test_venv/cas
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
test_venv/cas/manage.py migrate
test_venv/cas/manage.py createsuperuser
run_test_server: test_venv test_venv/cas
test_venv/cas/manage.py runserver