#!/bin/sh
#
# Copyright The IETF Trust 2007, All Rights Reserved
#
# Requires modelviz.py from
#  http://code.djangoproject.com/wiki/DjangoGraphviz
#
PYTHONPATH=`dirname $PWD`
export PYTHONPATH
DJANGO_SETTINGS_MODULE=ietf.settings
export DJANGO_SETTINGS_MODULE
for d in *
do
	if grep models.Model $d/models.py > /dev/null 2>&1
	then
		python modelviz.py $d
	fi
done > models-base.dot
unflatten -f -l 10 models-base.dot | gvpr -c '
BEG_G {
	node_t title = node($G, "title");
	title.shape="parallelogram";
	string model = $G.name;
	model = sub(model, "^ietf.");
	model = sub(model, ".models$");
	title.label = model;
	title.fontsize = 24;
}
' > models.dot
dot -Tps -Gsize=10.5,8.0 -Gmargin=0.25 -Gratio=auto -Grotate=90 models.dot | sed -e 's/ Bold/-Bold/' > models.ps
