Encapsulate build logic with bash and a Makefile.

This commit is contained in:
Connor Doyle
2015-01-27 17:28:17 -08:00
parent bdcf172423
commit 43cbaa594d
4 changed files with 50 additions and 0 deletions

10
Makefile Normal file
View File

@@ -0,0 +1,10 @@
all: env test
clean:
bin/clean.sh
env:
bin/env.sh
test:
bin/test.sh

9
bin/clean.sh Executable file
View File

@@ -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."

22
bin/env.sh Executable file
View File

@@ -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."

9
bin/test.sh Executable file
View File

@@ -0,0 +1,9 @@
#!/bin/bash -e
BASEDIR=`dirname $0`/..
cd $BASEDIR
source $BASEDIR/env/bin/activate
echo "Virtualenv activated."
tox