Skip to content

Commit

Permalink
Improve quality of build.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesoff committed Feb 20, 2017
1 parent 9d8dbc9 commit 715539f
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,25 @@

set -eu

VERSION=$1
VERSION="${1?Missing version parameter}"
BUILDDIR=simplemonitor-$VERSION

if [ -z "$VERSION" ]; then
echo Missing version parameter
exit 1
fi

cd build

[ -d $BUILDDIR ] && rm -rf $BUILDDIR
mkdir $BUILDDIR
[ -d "$BUILDDIR" ] && rm -rf "$BUILDDIR"
mkdir "$BUILDDIR"

echo "--> Copying files"

cp -v ../*.py ../monitor.sql ../LICENCE ../README.md ../CHANGELOG $BUILDDIR
cp -rv ../Monitors ../Alerters ../Loggers ../html $BUILDDIR
cp -v ../*.py ../monitor.sql ../LICENCE ../README.md ../CHANGELOG "$BUILDDIR"
cp -rv ../Monitors ../Alerters ../Loggers ../html "$BUILDDIR"

echo
echo "--> Tidying up"
find $BUILDDIR -name *.pyc -delete
find "$BUILDDIR" -name '*.pyc' -delete

echo
echo "--> Creating archives"
tar cjf ${BUILDDIR}.tar.gz $BUILDDIR
zip -r ${BUILDDIR}.zip $BUILDDIR
tar cjf "${BUILDDIR}.tar.gz" "$BUILDDIR"
zip -r "${BUILDDIR}.zip" "$BUILDDIR"

0 comments on commit 715539f

Please sign in to comment.