2016-06-19 11:18:32 +00:00
.PHONY : clean build install dist test_venv test_project
2015-12-23 13:41:31 +00:00
VERSION = ` python setup.py -V`
2015-12-17 13:44:06 +00:00
2015-12-12 13:28:19 +00:00
build :
python setup.py build
install :
python setup.py install
2015-12-18 10:35:18 +00:00
clean_pyc :
2015-12-12 13:28:19 +00:00
find ./ -name '*.pyc' -delete
find ./ -name __pycache__ -delete
2015-12-18 10:35:18 +00:00
clean_build :
2015-12-12 13:28:19 +00:00
rm -rf build django_cas_server.egg-info dist
2015-12-18 10:35:18 +00:00
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
2015-12-17 13:44:06 +00:00
2015-12-12 13:28:19 +00:00
dist :
python setup.py sdist
2015-12-17 13:44:06 +00:00
2016-06-19 11:18:32 +00:00
test_venv :
2015-12-17 13:44:06 +00:00
mkdir -p test_venv
virtualenv test_venv
2016-06-19 11:18:32 +00:00
test_venv/bin/pip install -U --requirement requirements.txt
2015-12-17 13:44:06 +00:00
2016-06-19 11:18:32 +00:00
test_venv/cas/manage.py :
2015-12-17 13:44:06 +00:00
mkdir -p test_venv/cas
test_venv/bin/django-admin startproject cas test_venv/cas
2016-06-19 11:18:32 +00:00
ln -s ../../cas_server test_venv/cas/cas_server
2015-12-17 13:44:06 +00:00
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
2015-12-17 18:04:41 +00:00
test_venv/bin/python test_venv/cas/manage.py migrate
test_venv/bin/python test_venv/cas/manage.py createsuperuser
2015-12-17 13:44:06 +00:00
2016-06-19 11:18:32 +00:00
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
2015-12-17 18:04:41 +00:00
test_venv/bin/python test_venv/cas/manage.py runserver
2016-06-25 09:26:56 +00:00
coverage : test_venv
test_venv/bin/pip install coverage
2016-06-26 08:55:08 +00:00
test_venv/bin/coverage run --source= 'cas_server' --omit= 'cas_server/migrations*' run_tests
2016-06-25 09:26:56 +00:00
test_venv/bin/coverage html
2016-06-27 21:55:17 +00:00
rm htmlcov/coverage_html.js # I am really pissed off by those keybord shortcuts
2016-06-26 08:41:15 +00:00
coverage_codacy : coverage
2016-06-27 21:55:17 +00:00
test_venv/bin/coverage xml
2016-06-26 08:41:15 +00:00
test_venv/bin/pip install codacy-coverage
test_venv/bin/python-codacy-coverage -r coverage.xml