Encapsulate build logic with bash and a Makefile.
This commit is contained in:
10
Makefile
Normal file
10
Makefile
Normal 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
9
bin/clean.sh
Executable 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
22
bin/env.sh
Executable 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
9
bin/test.sh
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
BASEDIR=`dirname $0`/..
|
||||
|
||||
cd $BASEDIR
|
||||
source $BASEDIR/env/bin/activate
|
||||
echo "Virtualenv activated."
|
||||
|
||||
tox
|
||||
Reference in New Issue
Block a user