Source

django-formrenderingtools / Makefile

Full commit
SHELL = /usr/bin/env bash

# Initialize some variables.
PROJECT = 'django-formrenderingtools'
ROOT_DIR = `cd $(@D) && pwd`
BUILDOUT_BOOTSTRAP_URL = http://svn.zope.org/*checkout*/zc.buildout/tags/1.5.2/bootstrap/bootstrap.py?content-type=text%2Fplain
BUILDOUT_CONFIGURATION = $(ROOT_DIR)/etc/buildout/buildout.cfg
# Programs. See http://www.gnu.org/software/make/manual/make.html#Implicit-Variables
WGET = wget
VIRTUALENV = virtualenv
PYTHON = $(ROOT_DIR)/lib/virtualenv/bin/python
BUILDOUT = $(ROOT_DIR)/bin/buildout -c $(BUILDOUT_CONFIGURATION)
DJANGO = $(ROOT_DIR)/bin/django

configure:
	# For now, we are using static configuration files (not real templates).
	# These files are stored locally in templates/ folder.
	# Generate local configuration.
	mkdir -p $(ROOT_DIR)/etc
	cp -R $(ROOT_DIR)/etc-templates/* $(ROOT_DIR)/etc/

virtualenv:
	if [ ! -f $(PYTHON) ]; then \
	    if [[ "`$(VIRTUALENV) --version`" < "`echo '1.8'`" ]]; then \
	        $(VIRTUALENV) --no-site-packages --distribute $(ROOT_DIR)/lib/virtualenv; \
	    else \
	        $(VIRTUALENV) $(ROOT_DIR)/lib/virtualenv; \
	    fi \
	fi

buildout:
	# Download zc.buildout's bootstrap script.
	if [ ! -f $(ROOT_DIR)/lib/buildout/bootstrap.py ]; then \
	    mkdir -p $(ROOT_DIR)/lib/buildout; \
	    $(WGET) $(BUILDOUT_BOOTSTRAP_URL) -O $(ROOT_DIR)/lib/buildout/bootstrap.py; \
	fi
	# Generate local directories file for zc.buildout (makes it possible to
	# set buildout:directory elsewhere than the main configuration file).
	echo "# Generated by $(ROOT_DIR)/makefile on `date --utc`" > $(ROOT_DIR)/etc/buildout/directories-local.cfg
	echo "[buildout]" >> $(ROOT_DIR)/etc/buildout/directories-local.cfg
	echo "directory = $(ROOT_DIR)" >> $(ROOT_DIR)/etc/buildout/directories-local.cfg
	# Bootstrap zc.buildout.
	if [ ! -f $(ROOT_DIR)/bin/buildout ]; then \
	    $(PYTHON) $(ROOT_DIR)/lib/buildout/bootstrap.py --distribute -c $(BUILDOUT_CONFIGURATION); \
	fi
	# Run zc.buildout.
	$(BUILDOUT) -N

update: buildout 

develop: virtualenv update

clean:
	rm -rf bin/ lib/

documentation:
	make --directory=docs clean html
	mkdir -p $(ROOT_DIR)/var/docs/html
	bin/rst2 html README > $(ROOT_DIR)/var/docs/html/README.html

test:
	bin/django test --config=$(ROOT_DIR)/etc/nose.cfg
	rm -f $(ROOT_DIR)/.coverage

release:
	# Freeze versions.
	cp $(ROOT_DIR)/etc/buildout/versions-kgs.cfg $(ROOT_DIR)/etc-templates/buildout/
	# Run zest.releaser.
	#bin/fullrelease