From 43cbaa594d9baf886545a983f89e5c352cf307b2 Mon Sep 17 00:00:00 2001 From: Connor Doyle Date: Tue, 27 Jan 2015 17:28:17 -0800 Subject: [PATCH] Encapsulate build logic with bash and a Makefile. --- Makefile | 10 ++++++++++ bin/clean.sh | 9 +++++++++ bin/env.sh | 22 ++++++++++++++++++++++ bin/test.sh | 9 +++++++++ 4 files changed, 50 insertions(+) create mode 100644 Makefile create mode 100755 bin/clean.sh create mode 100755 bin/env.sh create mode 100755 bin/test.sh diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..d68d94d --- /dev/null +++ b/Makefile @@ -0,0 +1,10 @@ +all: env test + +clean: + bin/clean.sh + +env: + bin/env.sh + +test: + bin/test.sh diff --git a/bin/clean.sh b/bin/clean.sh new file mode 100755 index 0000000..7478c99 --- /dev/null +++ b/bin/clean.sh @@ -0,0 +1,9 @@ +#!/bin/bash -e + +set -o errexit -o nounset -o pipefail + +BASEDIR=`dirname $0`/.. + +rm -rf $BASEDIR/.tox $BASEDIR/env +echo "Deleted virtualenv and test artifacts." + diff --git a/bin/env.sh b/bin/env.sh new file mode 100755 index 0000000..8cdaeb5 --- /dev/null +++ b/bin/env.sh @@ -0,0 +1,22 @@ +#!/bin/bash -e + +BASEDIR=`dirname $0`/.. + +if [ ! -d "$BASEDIR/env" ]; then + virtualenv -q $BASEDIR/env --prompt='(dcos-cli) ' + echo "Virtualenv created." +fi + +cd $BASEDIR +source $BASEDIR/env/bin/activate +echo "Virtualenv activated." + +if [ ! -f "$BASEDIR/env/updated" -o $BASEDIR/setup.py -nt $BASEDIR/env/updated ]; then + pip install -e $BASEDIR + touch $BASEDIR/env/updated + echo "Requirements installed." +fi + +pip install tox +echo "Tox installed." + diff --git a/bin/test.sh b/bin/test.sh new file mode 100755 index 0000000..cccb3c8 --- /dev/null +++ b/bin/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash -e + +BASEDIR=`dirname $0`/.. + +cd $BASEDIR +source $BASEDIR/env/bin/activate +echo "Virtualenv activated." + +tox