summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/format-code.sh3
-rwxr-xr-xscripts/make-release.sh31
-rw-r--r--scripts/mrswatson.astyle8
-rwxr-xr-xscripts/new-file.sh85
4 files changed, 127 insertions, 0 deletions
diff --git a/scripts/format-code.sh b/scripts/format-code.sh
new file mode 100755
index 0000000..606379a
--- /dev/null
+++ b/scripts/format-code.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+astyle --options=./scripts/mrswatson.astyle --recursive "main/*.c" "source/*.c" "source/*.cpp" "source/*.h" "test/*.c" "test/*.h"
diff --git a/scripts/make-release.sh b/scripts/make-release.sh
new file mode 100755
index 0000000..b91b5c5
--- /dev/null
+++ b/scripts/make-release.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+# Get latest version number
+VERSION=$(git tag | sort | tail -1)
+
+# Copy files to temporary working directory
+OUTDIR=MrsWatson-$VERSION
+cp -r bin $OUTDIR
+cp README.md $OUTDIR/README.txt
+cp LICENSE.txt $OUTDIR/LICENSE.txt
+
+# Copy documentation
+mkdir $OUTDIR/Docs
+for x in doc/* ; do
+ FILENAME=$(echo $(basename $x) | cut -d '.' -f 1)
+ cp $x $OUTDIR/Docs/$FILENAME.txt
+done
+
+# Cleanup crap which should not be shipped with distribution zipfile
+find $OUTDIR -name .DS_Store -exec rm {} \;
+rm -rf $OUTDIR/*/Debug
+rm -rf $OUTDIR/*/Release
+
+zip -r MrsWatson.zip $OUTDIR
+cp MrsWatson.zip MrsWatson-$VERSION.zip
+
+# Print out distribution zipfile size
+du -hs MrsWatson.zip
+
+# Cleanup scratch directory
+rm -rf $OUTDIR
diff --git a/scripts/mrswatson.astyle b/scripts/mrswatson.astyle
new file mode 100644
index 0000000..749f1d9
--- /dev/null
+++ b/scripts/mrswatson.astyle
@@ -0,0 +1,8 @@
+style=1tbs
+indent=spaces
+indent-preproc-define
+break-blocks
+pad-header
+pad-oper
+align-pointer=name
+align-reference=name
diff --git a/scripts/new-file.sh b/scripts/new-file.sh
new file mode 100755
index 0000000..9cb65bb
--- /dev/null
+++ b/scripts/new-file.sh
@@ -0,0 +1,85 @@
+#!/bin/bash
+if [ -z "$1" ] ; then
+ printf "Usage: new-file [file basename] (package)\n\n"
+ exit 1
+fi
+
+fileBasename=$1
+if ! [ -z "$2" ] ; then
+ filePackage=$2
+else
+ filePackage=""
+fi
+
+fullDate=$(date +"%d %b %y")
+year=$(date +"%Y")
+
+printf "//\n\
+// %s.h - MrsWatson\n\
+// Created by Nik Reiman on %s.\n\
+// Copyright (c) %s Teragon Audio. All rights reserved.\n\
+//\n\
+// Redistribution and use in source and binary forms, with or without\n\
+// modification, are permitted provided that the following conditions are met:\n\
+//\n\
+// * Redistributions of source code must retain the above copyright notice,\n\
+// this list of conditions and the following disclaimer.\n\
+// * Redistributions in binary form must reproduce the above copyright notice,\n\
+// this list of conditions and the following disclaimer in the documentation\n\
+// and/or other materials provided with the distribution.\n\
+//\n\
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n\
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n\
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n\
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n\
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n\
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n\
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n\
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n\
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n\
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n\
+// POSSIBILITY OF SUCH DAMAGE.\n\
+//\n\
+\n\
+#ifndef MrsWatson_${fileBasename}_h\n\
+#define MrsWatson_${fileBasename}_h\n\
+\n\
+#endif\n" "$fileBasename" "$fullDate" "$year" > source/$filePackage/$fileBasename.h
+printf "Created source/$filePackage/$fileBasename.h\n"
+
+printf "//\n\
+// %s.c - MrsWatson\n\
+// Created by Nik Reiman on %s.\n\
+// Copyright (c) %s Teragon Audio. All rights reserved.\n\
+//\n\
+// Redistribution and use in source and binary forms, with or without\n\
+// modification, are permitted provided that the following conditions are met:\n\
+//\n\
+// * Redistributions of source code must retain the above copyright notice,\n\
+// this list of conditions and the following disclaimer.\n\
+// * Redistributions in binary form must reproduce the above copyright notice,\n\
+// this list of conditions and the following disclaimer in the documentation\n\
+// and/or other materials provided with the distribution.\n\
+//\n\
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n\
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n\
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n\
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n\
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n\
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n\
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n\
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n\
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n\
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n\
+// POSSIBILITY OF SUCH DAMAGE.\n\
+//\n\
+\n\
+#include \"${fileBasename}.h\"\n\
+\n" "$fileBasename" "$fullDate" "$year" > source/$filePackage/$fileBasename.c
+printf "Created source/$filePackage/$fileBasename.c\n"
+
+printf "#include \"unit/TestRunner.h\"\n\
+#include \"$filePackage/$fileBasename.h\"\n\
+\n\
+\n" > test/$filePackage/${fileBasename}Test.c
+printf "Created test/$filePackage/${fileBasename}Test.c\n"