diff --git a/common/WHATSNEW.txt b/common/WHATSNEW.txt index 8b13789..e69de29 100644 --- a/common/WHATSNEW.txt +++ b/common/WHATSNEW.txt @@ -1 +0,0 @@ - diff --git a/makefile b/makefile index a81e213..948a79f 100644 --- a/makefile +++ b/makefile @@ -6,9 +6,9 @@ # # For Program Updates See: http://www.tundraware.com/Software/mkproject # -# $Id: makefile,v 1.105 2012/06/04 20:07:52 tundra Exp $ +# $Id: makefile,v 1.106 2012/06/05 16:50:16 tundra Exp $ -CVSID='$Id: makefile,v 1.105 2012/06/04 20:07:52 tundra Exp $' +CVSID='$Id: makefile,v 1.106 2012/06/05 16:50:16 tundra Exp $' # Uncomment One Of The Following For Early Releases @@ -24,20 +24,20 @@ TYPE = sh PROGMAIN = mkproject.sh -PROGFILES = ${PROGMAIN} .mkprojectrc +PROGFILES = ${PROGMAIN} tokens .mkprojectrc PROGDOCS = ${PROGMAIN}.ps SUPPDIRS = ./common ./pl ./py ./sh PROGSUPP = $(shell find ${SUPPDIRS} | grep -v CVS) -DOCS = ${PROGNAME}.1.gz \ +DOCS = ${PROGNAME}-license.txt \ + ${PROGNAME}.1.gz \ ${PROGNAME}.html \ ${PROGNAME}.pdf \ ${PROGNAME}.ps \ ${PROGNAME}.rst \ ${PROGNAME}.txt \ CHANGELOG.txt \ - mkproject-license.txt \ ##### diff --git a/tmkproject.rst b/tmkproject.rst index ae71f62..f17e650 100644 --- a/tmkproject.rst +++ b/tmkproject.rst @@ -198,6 +198,16 @@ __VENDORNAME__ Name of the project vendor (.mkprojectrc) __WEBSITE__ Website where updates can be found (.mkprojectrc) +You can also define additional substitution tokens of your own by +editing the ``tokens`` file provided with the program distribution. +This file is read every time you generate a new project. The +left-hand column is the name of the substitution token and the +right-hand column is the substitution text. The right-hand entry can +be any combination of variable references (assuming they are defined) +and literal text. *Bear in mind that this has to make sense to ``sed`` +which is used to do the actual substitutions!* For example, you will +see ``$`` and ``/`` escaped so that ``sed`` does the right thing. + OTHER ----- @@ -234,7 +244,7 @@ :: - $Id: tmkproject.rst,v 1.112 2012/06/04 15:56:34 tundra Exp $ + $Id: tmkproject.rst,v 1.113 2012/06/05 16:50:16 tundra Exp $ You can find the latest version of this program at: diff --git a/tmkproject.sh b/tmkproject.sh index 0600bd0..cf5267b 100755 --- a/tmkproject.sh +++ b/tmkproject.sh @@ -3,9 +3,9 @@ # # Copyright (c) 2012, TundraWare Inc., Des Plaines, IL 60018 USA # All Rights Reserved. For Terms Of Use, See: mkproject-license.txt -# $Id: tmkproject.sh,v 1.104 2012/06/04 19:36:29 tundra Exp $ +# $Id: tmkproject.sh,v 1.105 2012/06/05 16:50:16 tundra Exp $ -CVSID='$Id: tmkproject.sh,v 1.104 2012/06/04 19:36:29 tundra Exp $' +CVSID='$Id: tmkproject.sh,v 1.105 2012/06/05 16:50:16 tundra Exp $' # Make sure we have a valid command line @@ -40,6 +40,10 @@ . ${USERCONFIG} fi +# We'll need some temporary files + +TMPFILE=tmpfile +SEDRULES=sedrules # Make sure requested language is supported and # setup language-specific literals @@ -97,6 +101,15 @@ mkdir -p ${WRKDIR}/${RELEASES} cd ${WRKDIR} +# Pre-process the token defintions + +touch ${SEDRULES} +while read tokdef +do + rule="s/""`echo $tokdef | cut -d " " -f1`/`echo $tokdef | cut -d " " -f2-999`/g" + eval echo ${rule} >>${SEDRULES} +done < ${BASE}/tokens + # Copy project files, preserving permissions # Substitute template tokens with actual values @@ -104,35 +117,18 @@ do echo "Processing: ${F}" cp -p $F . - sed \ - -e s/__AUTHOR__/"${AUTHOR}"/g \ - -e s/__COPYRIGHT__/"${COPYRIGHT}"/g \ - -e s/__COST__/"${COST}"/g \ - -e s/__DESCRIPTION__/"${DESCRIPTION}"/g \ - -e s/__EDITOR__/"${EDITOR}"/g \ - -e s/__EDITARGS__/"${EDITARGS}"/g \ - -e s/__EMAILSUPPORT__/"${EMAILSUPPORT}"/g \ - -e s/__ID__/\$Id\$/ \ - -e s/__INTERPRETER__/"${INTERPRETER}"/g \ - -e s/__LANGUAGE__/"${LANGUAGE}"/g \ - -e s/__LICENSE__/"${LICENSE}"/g \ - -e s/__PROJECTNAME__/"${PROJECTNAME}"/g \ - -e s/__PY__/"${PY}"/g \ - -e s/__RESERVED__/"${RESERVED}"/g \ - -e s/__TYPE__/"${TYPE}"/g \ - -e s/__UPDATES__/"${UPDATES}"/g \ - -e s/__VENDORNAME__/"${VENDORNAME}"/g \ - -e s/__WEBSITE__/"${WEBSITE}"/g \ - <$F >`basename $F` + sed -f ${SEDRULES} <$F >`basename $F` done - # Combine the generic program template and the # language-specific program template -cat program_header program.${TYPE} >tmpfile -cat tmpfile >program.${TYPE} -rm tmpfile program_header +cat program_header program.${TYPE} >${TMPFILE} +cat ${TMPFILE} >program.${TYPE} + +# Clean up + +rm ${SEDRULES} ${TMPFILE} program_header # Set the project file names correctly diff --git a/tokens b/tokens new file mode 100644 index 0000000..0b1a740 --- /dev/null +++ b/tokens @@ -0,0 +1,18 @@ +__AUTHOR__ "${AUTHOR}" +__COPYRIGHT__ "${COPYRIGHT}" +__COST__ "${COST}" +__DESCRIPTION__ "${DESCRIPTION}" +__EDITOR__ "${EDITOR}" +__EDITARGS__ "${EDITARGS}" +__EMAILSUPPORT__ "${EMAILSUPPORT}" +__ID__ \\$Id\\$ +__INTERPRETER__ "${INTERPRETER}" +__LANGUAGE__ "${LANGUAGE}" +__LICENSE__ "${LICENSE}" +__PROJECTNAME__ "${PROJECTNAME}" +__PY__ "${PY}" +__RESERVED__ "${RESERVED}" +__TYPE__ "${TYPE}" +__UPDATES__ "${UPDATES}" +__VENDORNAME__ "${VENDORNAME}" +__WEBSITE__ "${WEBSITE}"