| 1 |
# Variables you might need to change in the first place |
| 2 |
# |
| 3 |
# This is probably the only section you'll need to change in this Makefile. |
| 4 |
# Also, make sure you don't remove the `<variables/>' tag. Cause those marks |
| 5 |
# are going to be used to update this file automatically. |
| 6 |
# |
| 7 |
# <variables> |
| 8 |
PACKAGE=forbiddenfruit |
| 9 |
CUSTOM_PIP_INDEX= |
| 10 |
export FFRUIT_EXTENSION=true |
| 11 |
# </variables> |
| 12 |
|
| 13 |
all: unit functional integration |
| 14 |
|
| 15 |
unit: |
| 16 |
@make run_test suite=unit |
| 17 |
|
| 18 |
functional: |
| 19 |
@make run_test suite=functional |
| 20 |
|
| 21 |
integration: |
| 22 |
@make run_test suite=integration |
| 23 |
|
| 24 |
run_test: |
| 25 |
@if [ -d tests/$(suite) ]; then \ |
| 26 |
echo "Running \033[0;32m$(suite)\033[0m test suite"; \ |
| 27 |
make prepare; \ |
| 28 |
nosetests --stop --with-coverage --cover-package=$(PACKAGE) \ |
| 29 |
--cover-branches --verbosity=2 -s tests/$(suite) ; \ |
| 30 |
fi |
| 31 |
|
| 32 |
prepare: clean install_deps build_test_stub |
| 33 |
|
| 34 |
install_deps: |
| 35 |
@if [ -z $$SKIP_DEPS ]; then \ |
| 36 |
echo "Installing missing dependencies..."; \ |
| 37 |
[ -e requirements.txt ] && pip install -r requirements.txt &> .build.log; \ |
| 38 |
[ -e development.txt ] && pip install -r development.txt &> .build.log; \ |
| 39 |
fi |
| 40 |
|
| 41 |
build_test_stub: |
| 42 |
@python setup.py build |
| 43 |
@find ./build -name '*.so' -exec mv {} tests/unit \; |
| 44 |
|
| 45 |
clean: |
| 46 |
@echo "Removing garbage..." |
| 47 |
@find . -name '*.pyc' -delete |
| 48 |
@find . -name '*.so' -delete |
| 49 |
@find . -name __pycache__ -delete |
| 50 |
@rm -rf .coverage *.egg-info *.log build dist MANIFEST |
| 51 |
|
| 52 |
publish: |
| 53 |
@if [ -e "$$HOME/.pypirc" ]; then \ |
| 54 |
echo "Uploading to '$(CUSTOM_PIP_INDEX)'"; \ |
| 55 |
python setup.py sdist upload -r "$(CUSTOM_PIP_INDEX)"; \ |
| 56 |
else \ |
| 57 |
echo "You should create a file called \`.pypirc' under your home dir.\n"; \ |
| 58 |
echo "That's the right place to configure \`pypi' repos.\n"; \ |
| 59 |
echo "Read more about it here: https://github.com/Yipit/yipit/blob/dev/docs/rfc/RFC00007-python-packages.md"; \ |
| 60 |
exit 1; \ |
| 61 |
fi |