@@ 0,0 1,146 @@
+APP := foobee
+
+# =============================================================================
+
+export LC_ALL := en_US.UTF-8
+
+VIRTUALENV := virtualenv --python=python3
+ECHO := echo
+SED := sed
+FIND := find
+
+.DEFAULT_GOAL := build
+
+# =============================================================================
+# help
+# =============================================================================
+
+.PHONY: help
+help:
+ @$(ECHO) -e "$$(grep -hE '^\S+:.*##' $(MAKEFILE_LIST) | $(SED) -e 's/:.*##\s*/:/' -e 's/^\(.\+\):\(.*\)/\\x1b[36m\1\\x1b[m:\2/' | column -c2 -t -s :)"
+
+# =============================================================================
+# clean up
+# =============================================================================
+
+.PHONY: clean
+clean: ## clean up binary files and other stuff to trigger a fast rebuild
+clean:
+ $(FIND) src \( -name '*.pyc' -o -name '*.pyo' -o -name '*~' \) -delete
+ touch setup.py
+ touch requirements.txt
+ rm -f env/_done_*
+
+.PHONY: distclean
+distclean: ## remove everything ever created by this make file
+distclean: clean
+ rm -f bin
+ rm -rf env
+
+# =============================================================================
+# virtual environment
+# =============================================================================
+
+env/bin/python:
+ $(VIRTUALENV) env
+
+env/_done_requirements: requirements.txt
+ env/bin/pip install -U -r requirements.txt
+ touch $@
+
+bin:
+ ln -s env/bin
+
+.PHONY: env
+env: env/bin/python bin
+env: env/_done_requirements
+
+# =============================================================================
+# init (can be removed when initialized)
+# =============================================================================
+
+define SETUP
+from setuptools import setup, find_packages
+
+setup(
+ name="$(APP)",
+ version='1',
+ author='Oben Sonne',
+ packages=find_packages('src'),
+ package_dir={'': 'src'},
+ install_requires=[],
+ entry_points={
+ 'console_scripts': [
+ '$(APP) = $(APP).cli:main',
+ ],
+ },
+)
+endef
+export SETUP
+
+define HGIGNORE
+syntax: glob
+env
+.project
+.pydevproject
+.settings
+*.egg-info
+*.pyc
+*~
+__pycache__
+SNAPSHOT
+bin
+endef
+export HGIGNORE
+
+.hgignore:
+ @echo "$$HGIGNORE" > $@
+
+setup.py:
+ @echo "$$SETUP" > $@
+
+requirements.txt:
+ echo nose > $@
+
+src/$(APP):
+ mkdir -p $@
+ touch $@/__init__.py
+ touch $@/cli.py
+ mkdir $@/tests
+ touch $@/tests/__init__.py
+ touch $@/tests/cli_tests.py
+
+.PHONY: init
+init: | .hgignore requirements.txt setup.py src/$(APP)
+
+.PHONY: initclean
+initclean:
+ rm -f .hgignore
+ rm -rf src
+ rm -f setup.py
+ rm -f requirements.txt
+
+# =============================================================================
+# build
+# =============================================================================
+
+env/_done_install:
+ env/bin/pip install -U -e .
+ touch $@
+
+.PHONY: build
+build: ## build everything needed to run apps
+build: env
+build: env/_done_install
+
+# =============================================================================
+# tests
+# =============================================================================
+
+items := $(APP)
+options :=
+
+.PHONY: test
+test: ## run the test suite (use items=... to name packages and options=... to control nose)
+test: build
+ env/bin/nosetests $(items) $(options)