#!/bin/bash

WEBDIR=/home/jm/public_html_wm

vers=`build/get_version`

# delete old CVS files
find . -name '.#*' -print | xargs rm -f

make clean ; perl Makefile.PL ; make

echo "Building documentation..."
( cd doc ; ../webmake )
make distcheck

echo "Creating 'Changes' file from CVS change log..."
cvs2cl.pl -f Changes

rm -f HTML-WebMake-$vers.tar.gz HTML-WebMake-$vers.zip
make tardist
cp HTML-WebMake-$vers.tar.gz $WEBDIR/devel

make zipdist
cp HTML-WebMake-$vers.zip $WEBDIR/devel

echo "Copying distribution into /dist on site..."
(
  cd $WEBDIR
  tar xfz devel/HTML-WebMake-$vers.tar.gz	\
		2>&1 | grep -v 'Archive contains future timestamp'
  rm -rf dist ; mv HTML-WebMake-$vers dist

  rm -rf doc ; cp -r dist/doc doc
)

ls -l $WEBDIR/devel
