Cleaned up the doc generation and release scripts. I also changed the last modified

time on each page to be the last time the corresponding XML file was modified
rather than the overall project release date.
This commit is contained in:
Davis King 2011-05-22 11:05:12 -04:00
parent bf2ce54eb4
commit 5b4a43639e
2 changed files with 40 additions and 30 deletions

View File

@ -32,6 +32,11 @@ get_short_revision_number()
RESULT=`hg log -r $1 | grep changeset | awk '{print $2}' | sed -e 's/:.*//'` RESULT=`hg log -r $1 | grep changeset | awk '{print $2}' | sed -e 's/:.*//'`
} }
get_last_modified_date()
{
RESULT=`hg log $1 -l1 --template '{date|date}\n' | awk '{ print $2" "$3", " $5}'`
}
makedocs () makedocs ()
{ {
@ -46,7 +51,7 @@ makedocs ()
LOGGER_REVNUM=$RESULT LOGGER_REVNUM=$RESULT
XSLT_OPTIONS="--nodtdattr --nonet --novalid" XSLT_OPTIONS="--nodtdattr --nonet --novalid"
DATE=`date --date= "+%b %d, %Y"`; DATE_TODAY=`date --date= "+%b %d, %Y"`;
@ -57,14 +62,9 @@ makedocs ()
REVISION=$RESULT REVISION=$RESULT
if [ "$1" = "snapshot" ] MAJOR_NUM=`cat $COUNTER_FILE`
then MINOR_NUM=`cat $MINOR_COUTNER_FILE`
RELEASE="developmental snapshot $REVISION" RELEASE=${MAJOR_NUM}.${MINOR_NUM}
else
MAJOR_NUM=`cat $COUNTER_FILE`
MINOR_NUM=`cat $MINOR_COUTNER_FILE`
RELEASE=${MAJOR_NUM}.${MINOR_NUM}
fi;
# get XML versions of the change logs # get XML versions of the change logs
BASE_LOGGER_REVNUM=`echo $LOGGER_REVNUM - 1000 | bc` BASE_LOGGER_REVNUM=`echo $LOGGER_REVNUM - 1000 | bc`
@ -142,25 +142,35 @@ makedocs ()
# make the web page version # generate the HTML docs
echo Generate web page from XML and XSLT style sheet echo Generate HTML docs from XML and XSLT style sheet
cat docs/stylesheet.xsl | sed -e 's/"is_chm">[^<]*/"is_chm">false/' -e "s/_CURRENT_RELEASE_/$RELEASE/" -e "s/_LAST_MODIFIED_DATE_/$DATE/" \ FILES=`\ls docs/*.xml | grep -v main_menu.xml`
> docs/stylesheet.$$.xsl for i in $FILES
\ls docs/*.xml | xargs -i echo -o {} docs/stylesheet.$$.xsl {} | \ do
sed -e "s/\.xml /\.html /" | sed -e "s/-o docs/-o docs\/web/" | \
grep -v main_menu. |\
xargs -l xsltproc $XSLT_OPTIONS
rm docs/stylesheet.$$.xsl
# make the chm version # The last modified date for these files should always be the release date (regardless of when the actual xml files were modified).
echo Generate non-web page version from XML and XSLT style sheet if [ "${i}" = "docs/release_notes.xml" -o ${i} = "docs/change_log.xml" -o ${i} = "docs/old_change_log.xml" -o ${i} = "docs/index.html" ]
cat docs/stylesheet.xsl | sed -e 's/"is_chm">[^<]*/"is_chm">true/' -e "s/_CURRENT_RELEASE_/$RELEASE/" -e "s/_LAST_MODIFIED_DATE_/$DATE/" \ then
> docs/stylesheet.$$.xsl DATE=$DATE_TODAY
\ls docs/*.xml | xargs -i echo -o {} docs/stylesheet.$$.xsl {} | \ else
sed -e "s/\.xml /\.html /" | sed -e "s/-o docs/-o docs\/chm\/docs/" | \ get_last_modified_date ${i}
grep -v main_menu. |\ DATE=$RESULT
xargs -l xsltproc $XSLT_OPTIONS fi;
rm docs/stylesheet.$$.xsl
#make web version
cat docs/stylesheet.xsl | sed -e 's/"is_chm">[^<]*/"is_chm">false/' -e "s/_CURRENT_RELEASE_/$RELEASE/" -e "s/_LAST_MODIFIED_DATE_/$DATE/" \
> docs/stylesheet.$$.xsl
OUT_FILE=$(echo ${i} | sed -e "s/\.xml/\.html/" | sed -e "s/docs\//docs\/web\//")
xsltproc $XSLT_OPTIONS -o $OUT_FILE docs/stylesheet.$$.xsl ${i}
#make chm version
cat docs/stylesheet.xsl | sed -e 's/"is_chm">[^<]*/"is_chm">true/' -e "s/_CURRENT_RELEASE_/$RELEASE/" -e "s/_LAST_MODIFIED_DATE_/$DATE/" \
> docs/stylesheet.$$.xsl
OUT_FILE=$(echo ${i} | sed -e "s/\.xml/\.html/" | sed -e "s/docs\//docs\/chm\/docs\//")
xsltproc $XSLT_OPTIONS -o $OUT_FILE docs/stylesheet.$$.xsl ${i}
rm docs/stylesheet.$$.xsl
done
FILES=`find docs/chm docs/web -iname "*.html" -type f` FILES=`find docs/chm docs/web -iname "*.html" -type f`
@ -190,7 +200,7 @@ makedocs ()
# build all the html documentation # build all the html documentation
makedocs $1; makedocs
# now make the table of contents for the chm file # now make the table of contents for the chm file
echo Generating the table of contents for the chm file echo Generating the table of contents for the chm file

View File

@ -27,14 +27,14 @@ if [ "$1" = "major" ]
MINOR_NUM=0 MINOR_NUM=0
echo $MAJOR_NUM > $COUNTER_FILE echo $MAJOR_NUM > $COUNTER_FILE
echo $MINOR_NUM > $MINOR_COUTNER_FILE echo $MINOR_NUM > $MINOR_COUTNER_FILE
./makedocs major || exit 1
else else
MAJOR_NUM=`cat $COUNTER_FILE` MAJOR_NUM=`cat $COUNTER_FILE`
MINOR_NUM=`cat $MINOR_COUTNER_FILE | awk '{print $1 + 1}'` MINOR_NUM=`cat $MINOR_COUTNER_FILE | awk '{print $1 + 1}'`
echo $MINOR_NUM > $MINOR_COUTNER_FILE echo $MINOR_NUM > $MINOR_COUTNER_FILE
./makedocs || exit 1
fi; fi;
./makedocs || exit 1
rm -rf release || report_failure rm -rf release || report_failure
mkdir release || report_failure mkdir release || report_failure