1. Benoît Bryon
  2. django-formrenderingtools

Source

django-formrenderingtools / Makefile

Diff from to

File Makefile

-SHELL = /usr/bin/env bash
+# Makefile for development.
+SHELL = /bin/bash
+ROOT_DIR = $(shell pwd)
+BIN_DIR = $(ROOT_DIR)/bin
+DATA_DIR = $(ROOT_DIR)/var
+WGET = wget
+PYTHON = $(shell which python)
+BUILDOUT_CFG = $(ROOT_DIR)/etc/buildout.cfg
+BUILDOUT_DIR = $(ROOT_DIR)/lib/buildout
+BUILDOUT_VERSION = 1.7.0
+BUILDOUT_BOOTSTRAP_URL = https://raw.github.com/buildout/buildout/$(BUILDOUT_VERSION)/bootstrap/bootstrap.py
+BUILDOUT_BOOTSTRAP = $(BUILDOUT_DIR)/bootstrap.py
+BUILDOUT_BOOTSTRAP_ARGS = -c $(BUILDOUT_CFG) --version=$(BUILDOUT_VERSION) --distribute buildout:directory=$(ROOT_DIR)
+BUILDOUT = $(BIN_DIR)/buildout
+BUILDOUT_ARGS = -N -c $(BUILDOUT_CFG) buildout:directory=$(ROOT_DIR)
+NOSE = $(BIN_DIR)/nosetests
+DJANGO = $(BIN_DIR)/bin/django
 
-# 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/
+	# Configuration is stored in etc/ folder. Not generated yet.
 
-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
+
+develop: buildout
+
 
 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
+	if [ ! -d $(BUILDOUT_DIR) ]; then mkdir -p $(BUILDOUT_DIR); fi
+	if [ ! -f $(BUILDOUT_BOOTSTRAP) ]; then wget -O $(BUILDOUT_BOOTSTRAP) $(BUILDOUT_BOOTSTRAP_URL); fi
+	if [ ! -x $(BUILDOUT) ]; then $(PYTHON) $(BUILDOUT_BOOTSTRAP) $(BUILDOUT_BOOTSTRAP_ARGS); fi
+	$(BUILDOUT) $(BUILDOUT_ARGS)
 
-update: buildout 
-
-develop: virtualenv update
 
 clean:
-	rm -rf bin/ lib/
+	find $(ROOT_DIR)/ -name "*.pyc" -delete
+	find $(ROOT_DIR)/ -name ".noseids" -delete
+
+
+distclean: clean
+	rm -rf $(ROOT_DIR)/*.egg-info
+	rm -rf $(ROOT_DIR)/demo/*.egg-info
+
+
+maintainer-clean: distclean
+	rm -rf $(ROOT_DIR)/bin/
+	rm -rf $(ROOT_DIR)/lib/
+
+
+test: test-demo test-documentation
+
+
+test-demo:
+	bin/demo test
+	mv $(ROOT_DIR)/.coverage $(ROOT_DIR)/var/test/demo.coverage
+
+
+test-documentation:
+	bin/nosetests -c $(ROOT_DIR)/etc/nose.cfg sphinxcontrib.testbuild.tests
+	mv $(ROOT_DIR)/.coverage $(ROOT_DIR)/var/test/documentation.coverage
+
 
 documentation:
-	make --directory=docs clean html
-	mkdir -p $(ROOT_DIR)/var/docs/html
-	bin/rst2 html README > $(ROOT_DIR)/var/docs/html/README.html
+	make --directory=docs clean html doctest
 
-test:
-	bin/django test --config=$(ROOT_DIR)/etc/nose.cfg
-	rm -f $(ROOT_DIR)/.coverage
+
+demo: develop
+	bin/demo syncdb --noinput
+	bin/demo runserver
+
 
 release:
-	# Freeze versions.
-	cp $(ROOT_DIR)/etc/buildout/versions-kgs.cfg $(ROOT_DIR)/etc-templates/buildout/
-	# Run zest.releaser.
-	bin/fullrelease
+	$(BIN_DIR)/fullrelease