From 9d0c5e04d500293f5f0083605c3f523ffa6c4522 Mon Sep 17 00:00:00 2001 From: Daniele Olmisani Date: Fri, 29 Dec 2017 15:20:58 +0100 Subject: [PATCH] fixed deploy script --- _scripts/deploy.sh | 60 ++++++++++++++++++++++++++++++++++++++++++++++ deploy.sh | 43 --------------------------------- 2 files changed, 60 insertions(+), 43 deletions(-) create mode 100644 _scripts/deploy.sh delete mode 100755 deploy.sh diff --git a/_scripts/deploy.sh b/_scripts/deploy.sh new file mode 100644 index 00000000..74ea7079 --- /dev/null +++ b/_scripts/deploy.sh @@ -0,0 +1,60 @@ +#!/bin/bash + +TEMP=temp +TEMPLATES=_templates +EXAMPLES=examples + +TARGET=. + +ROOT=`pwd` + +BUILD=`git rev-list HEAD | wc -l` +VERSION=`git describe --tags` + + +# check for root folder +if [ ! -d $ROOT/$EXAMPLES ]; then + ROOT=$(dirname $ROOT) +fi + +if [ ! -d $ROOT/$EXAMPLES ]; then + echo "[DEPLOY] ERROR: unable to find root folder." + exit -1 +fi + + +echo "[DEPLOY] Building '$VERSION' / build '$BUILD' in folder '$TARGET' using '$TEMP'..." +echo "[DEPLOY] using root folder '$ROOT'" + +# cleanup any residual build +rm -fR $ROOT/$TEMP/ +rm -f $ROOT/$TARGET/book-mdpc.txt +rm -f $ROOT/$TARGET/book-mdpc.zip + +if [ ! -d $ROOT/$TARGET ]; then + mkdir -p $ROOT/$TARGET +fi + +# create working area +mkdir -p $ROOT/$TEMP/book-mdpc/examples + +# create contents +cp -R $ROOT/$EXAMPLES $ROOT/$TEMP/book-mdpc/ +find $ROOT/$TEMP/ -type f -name '*.template' -delete +sed -e "s/##BUILD##/$BUILD/g" \ + -e "s/##VERSION##/$VERSION/g" $ROOT/$TEMPLATES/examples.properties.template > $ROOT/$TARGET/examples.properties +cp $ROOT/$TARGET/examples.properties $ROOT/$TEMP/book-mdpc +cp $ROOT/$TARGET/examples.properties $ROOT/$TEMP/book-mdpc.txt +cp $ROOT/$TARGET/LICENSE $ROOT/$TEMP/book-mdpc +cp $ROOT/$TARGET/README.md $ROOT/$TEMP/book-mdpc +cd $ROOT/$TEMP +zip -rq book-mdpc.zip book-mdpc/ +cd - > /dev/null +cp $ROOT/$TEMP/book-mdpc.txt $ROOT/$TARGET/ +cp $ROOT/$TEMP/book-mdpc.zip $ROOT/$TARGET/ + +# remove working area +rm $ROOT/$TARGET/examples.properties +rm -fR $ROOT/$TEMP + +echo "...DONE" \ No newline at end of file diff --git a/deploy.sh b/deploy.sh deleted file mode 100755 index 40ff57ee..00000000 --- a/deploy.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash - -TEMP=temp -TARGET=. -TEMPLATES=templates - -BUILD=`git rev-list HEAD | wc -l` -VERSION=`git describe --tags` - -echo "Building '$VERSION' / build '$BUILD' in folder '$TARGET' using '$TEMP'..." - -# cleanup any residual build -rm -fR $TEMP/ -rm -f $TARGET/book-mdpc.txt -rm -f $TARGET/book-mdpc.zip - -if [ ! -d $TARGET ]; then - mkdir -p $TARGET -fi - -# create working area -mkdir -p $TEMP/book-mdpc/examples - -# create contents -cp -R examples/ $TEMP/book-mdpc/ -find $TEMP/ -type f -name '*.template' -delete -sed -e "s/##BUILD##/$BUILD/g" \ - -e "s/##VERSION##/$VERSION/g" $TEMPLATES/examples.properties.template > examples.properties -cp examples.properties $TEMP/book-mdpc -cp examples.properties $TEMP/book-mdpc.txt -cp LICENSE $TEMP/book-mdpc -cp README.md $TEMP/book-mdpc -cd $TEMP -zip -rq book-mdpc.zip book-mdpc/ -cd - > /dev/null -cp $TEMP/book-mdpc.txt $TARGET/ -cp $TEMP/book-mdpc.zip $TARGET/ - -# remove working area -rm examples.properties -rm -fR $TEMP - -echo "...DONE" \ No newline at end of file