lemur/Makefile

136 lines
3.7 KiB
Makefile
Raw Permalink Normal View History

2015-07-21 01:13:42 +02:00
NPM_ROOT = ./node_modules
STATIC_DIR = src/lemur/static/app
2018-03-29 18:10:41 +02:00
SHELL=/bin/bash
2016-10-09 09:05:50 +02:00
USER := $(shell whoami)
2015-07-21 01:13:42 +02:00
develop: update-submodules setup-git
@echo "--> Installing dependencies"
2016-10-09 09:05:50 +02:00
ifeq ($(USER), root)
@echo "WARNING: It looks like you are installing Lemur as root. This is not generally advised."
npm install --unsafe-perm
else
2015-07-21 01:13:42 +02:00
npm install
2016-10-09 09:05:50 +02:00
endif
2015-07-21 01:13:42 +02:00
pip install "setuptools>=0.9.8"
# order matters here, base package must install first
pip install -e .
pip install "file://`pwd`#egg=lemur[dev]"
pip install "file://`pwd`#egg=lemur[tests]"
2015-09-22 23:49:37 +02:00
node_modules/.bin/gulp build
node_modules/.bin/gulp package --urlContextPath=$(urlContextPath)
2015-07-21 01:13:42 +02:00
@echo ""
release:
@echo "--> Installing dependencies"
ifeq ($(USER), root)
@echo "WARNING: It looks like you are installing Lemur as root. This is not generally advised."
npm install --unsafe-perm
else
npm install
endif
pip install "setuptools>=0.9.8"
# order matters here, base package must install first
pip install -e .
node_modules/.bin/gulp build
node_modules/.bin/gulp package --urlContextPath=$(urlContextPath)
@echo ""
2015-07-21 01:13:42 +02:00
dev-docs:
2019-07-09 20:13:11 +02:00
pip install -r requirements-docs.txt
2015-07-21 01:13:42 +02:00
reset-db:
@echo "--> Dropping existing 'lemur' database"
dropdb lemur || true
@echo "--> Creating 'lemur' database"
createdb -E utf-8 lemur
2018-11-05 23:37:52 +01:00
@echo "--> Enabling pg_trgm extension"
psql lemur -c "create extension IF NOT EXISTS pg_trgm;"
2015-07-21 01:13:42 +02:00
@echo "--> Applying migrations"
2019-07-30 19:32:09 +02:00
cd lemur && lemur db upgrade
2015-07-21 01:13:42 +02:00
setup-git:
2020-08-26 10:47:17 +02:00
@echo "--> Installing git hooks"
if [ -d .git/hooks ]; then \
git config branch.autosetuprebase always; \
cd .git/hooks && ln -sf ../../hooks/* ./; \
fi
2020-08-26 10:47:17 +02:00
@echo ""
2015-07-21 01:13:42 +02:00
clean:
@echo "--> Cleaning static cache"
${NPM_ROOT}/.bin/gulp clean
@echo "--> Cleaning pyc files"
find . -name "*.pyc" -delete
@echo ""
2015-07-21 17:42:00 +02:00
test: develop lint test-python
2015-07-21 01:13:42 +02:00
testloop: develop
pip install pytest-xdist
coverage run --source lemur -m py.test
2015-07-21 01:13:42 +02:00
test-cli:
@echo "--> Testing CLI"
rm -rf test_cli
mkdir test_cli
cd test_cli && lemur create_config -c ./test.conf > /dev/null
cd test_cli && lemur -c ./test.conf db upgrade > /dev/null
cd test_cli && lemur -c ./test.conf help 2>&1 | grep start > /dev/null
rm -r test_cli
@echo ""
test-js:
@echo "--> Running JavaScript tests"
npm test
@echo ""
test-python:
@echo "--> Running Python tests"
2016-11-17 20:11:09 +01:00
coverage run --source lemur -m py.test
2015-07-21 01:13:42 +02:00
@echo ""
lint: lint-python lint-js
lint-python:
@echo "--> Linting Python files"
2015-07-21 18:50:33 +02:00
PYFLAKES_NODOCTEST=1 flake8 lemur
2015-07-21 01:13:42 +02:00
@echo ""
lint-js:
@echo "--> Linting JavaScript files"
npm run lint
@echo ""
coverage: develop
coverage run --source=lemur -m py.test
coverage html
publish:
python setup.py sdist bdist_wheel upload
2018-03-29 18:10:41 +02:00
up-reqs:
ifndef VIRTUAL_ENV
$(error Please activate virtualenv first)
endif
@echo "--> Updating Python requirements"
2018-04-23 18:23:23 +02:00
pip install --upgrade pip
2018-03-29 18:10:41 +02:00
pip install --upgrade pip-tools
pip-compile --output-file requirements.txt requirements.in -U --no-index
2018-04-12 17:52:47 +02:00
pip-compile --output-file requirements-docs.txt requirements-docs.in -U --no-index
pip-compile --output-file requirements-dev.txt requirements-dev.in -U --no-index
pip-compile --output-file requirements-tests.txt requirements-tests.in -U --no-index
2018-03-29 18:10:41 +02:00
@echo "--> Done updating Python requirements"
2018-04-23 18:23:23 +02:00
@echo "--> Removing python-ldap from requirements-docs.txt"
grep -v "python-ldap" requirements-docs.txt > tempreqs && mv tempreqs requirements-docs.txt
2018-03-29 18:10:41 +02:00
@echo "--> Installing new dependencies"
pip install -e .
@echo "--> Done installing new dependencies"
@echo ""
# Execute with make checkout-pr pr=<pr number>
checkout-pr:
git fetch upstream pull/$(pr)/head:pr-$(pr)
2018-03-29 18:10:41 +02:00
.PHONY: develop dev-postgres dev-docs setup-git build clean update-submodules test testloop test-cli test-js test-python lint lint-python lint-js coverage publish release