#!/bin/bash # creates the file architecture for a new user package if [ $# -lt 5 ] then echo "usage : bbCreateBlackBox [author] [description] [category]" echo " type: " echo " std " echo " VTK_ImageAlgorithm " echo " VTK_PolyDataAlgorithm " echo " widget " echo " format: " echo " XML " echo " C++ " #bbCreateBox [author] [description] [category]" exit fi # bbCreatePackage path TMP=$(which $0|rev) BINPATH=$(echo ${TMP#*/}|rev) #INPUT=$1 OUTPUT_DIR=$1 PACKAGE=$2 BOX=$3 TYPE=$4 FORMAT=$5 AUTHOR=$6 DESCRIPTION=$7 CATEGORY=$8 # Input template file INPUT=${BINPATH}/@bbCreateBlackBox_DATA_REL_PATH_FROM_BIN@/xml-templates/${TYPE}-template.xml FILENAME=bb${PACKAGE}${BOX} echo "output dir = " $OUTPUT_DIR echo "box name = " $BOX echo "package = " $PACKAGE echo "author = " $AUTHOR echo "description = " $DESCRIPTION echo "category = " $CATEGORY echo "type = " $TYPE echo "format = " $FORMAT echo "input = " $INPUT echo "** Creating new black box '$BOX' in folder '$OUTPUT_DIR'" if [ -f ${OUTPUT_DIR}/${FILENAME}.xml ] then echo "Error : ${OUTPUT_DIR}/${FILENAME}.xml already exists" exit fi echo " - Creating ${FILENAME}.xml" sed s,__BLACKBOXNAME__,"${BOX}", < ${INPUT} | sed s/__AUTHOR__/"${AUTHOR}"/ | sed s{__DESCRIPTION__{"${DESCRIPTION}"{ | sed s/__CATEGORY__/"${CATEGORY}"/ > ${OUTPUT_DIR}/${FILENAME}.xml if [ "${FORMAT}" = "C++" ] then if [ -f ${OUTPUT_DIR}/${FILENAME}.h ] then echo "Error : ${OUTPUT_DIR}/${FILENAME}.h already exists" exit fi echo " - Creating ${FILENAME}.h/cxx" ${BINPATH}/bbfy ${OUTPUT_DIR}/${FILENAME}.xml ${PACKAGE} ${OUTPUT_DIR}/ -q echo " - Deleting ${FILENAME}.xml" rm ${OUTPUT_DIR}/${FILENAME}.xml fi echo "Done !"