# Simple shell script to do all the steps that need doing
#
+# if a parameter exists, that's where the website is copied after generation
+if [ -n "$1" ]
+then
+ DIRHTML=$(echo "$1"|sed 's/\/$//g'); #strips the trailing slash if need be
+else
+ DIRHTML="";
+fi
+
+# create the required folders if need be, or empties them
+if [ ! -d "_site" ]; then
+ mkdir _site
+else
+ rm -rf _site/*
+fi
+
+if [ ! -d "_manual" ]; then
+ mkdir _manual
+else
+ rm -rf _manual/*
+fi
+
rm -rf _build/* && \
./munge && \
-./build.rb
+ruby2.2 ./build.rb
+chmod -R a+rx _site
+
+# if a target directory exists, copy the site there
+if [ ! -z "$DIRHTML" ]
+then
+ rm -rf "$DIRHTML/*"
+ cp -R _site/* "$DIRHTML/"
+fi
+