#!/bin/sh

# This script prepares for a new release, helping to remember
# which files to update and in what order.

# Simple test to see where we are
# FIXME: Does not work when typing ./scripts/...
CHECK=`echo $0 | cut -d'/' -f1`
if [ "$CHECK" != "scripts" ]; then
	echo "This script must be run from the top level directory."
	exit 1
fi

echo '- Edit configure.ac with new version number'
sleep 1
/usr/bin/nano configure.ac

echo '- Edit ChangeLog'
sleep 1
/usr/bin/nano ChangeLog

echo '- Recompiling to run benchmark problems'
sleep 1
scripts/preconfigure
./configure --enable-optimization
make clean
make

echo '- Running DOLFIN benchmark problem'
sleep 1
src/demo/bench/dolfin-bench >> src/demo/bench/bench.log

echo '- Running benchmark problem for multi-adaptive solver'
sleep 1
cd src/demo/solvers/ode/bench
./run-bench.sh >> bench.log 2>&1
cd ../../../../..

echo '- Commiting changes to cvs'
sleep 1
/usr/bin/cvs commit

echo '- Type: cvs rtag v0_2_0 dolfin (with correct version number)'
echo '- Then checkout a clean version and run scripts/makedist'
