diff --git a/sde_update.sh b/sde_update.sh new file mode 100644 index 0000000..e42b511 --- /dev/null +++ b/sde_update.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +SDE_URL="https://www.fuzzwork.co.uk/dump/sqlite-latest.sqlite.bz2" + +echo "Downloading SDE from ${SDE_URL}" +curl -o sde.sqlite.bz2 "${SDE_URL}" && bunzip2 sde.sqlite.bz2 +if [ -e sde.sqlite ]; then + echo "Generating reference data" + /usr/bin/env python gen_reference_data.py sde.sqlite + cp *.json dropbot/data/ + + echo "Running unit tests" + /usr/bin/env python setup.py test > /dev/null 2>&1 + + if [ $? -eq 0 ]; then + git add dropbox/data/*.json + git status + echo "SDE data updated successfully" + else + echo "Unit tests failed, please investigate" + fi +else + echo "Error downloading SDE" + exit 1 +fi