Skip to content

Instantly share code, notes, and snippets.

@tjdett
Created December 21, 2011 00:52
Show Gist options
  • Save tjdett/1504020 to your computer and use it in GitHub Desktop.
Save tjdett/1504020 to your computer and use it in GitHub Desktop.
Util for testing - prints green for 0 exit status, otherwise red
#!/bin/sh
while (true)
do
inotifywait -r -e close_write tardis/apps
red_green.sh bin/django test --settings=tardis.test_settings --failfast --tests='tardis.apps.oaipmh.tests.test_oai'
done
#!/bin/bash
# Author: Tim Dettrick
# Usage: red_green.sh <test_cmd>
# Example: red_green.sh bin/django test
RED="\033[0;31m"
GREEN="\033[0;32m"
NO_COLOUR="\033[0m"
SOLID_BLOCK=`echo -e "\xE2\x96\x88"`
BAR="#####################################################"
if [[ $LANG == 'en_US.UTF-8' ]]; then
BAR=`echo $BAR | sed -e "s/#/${SOLID_BLOCK}/g"`
fi
$@
RESULT=$?
if [[ $RESULT == 0 ]]; then
echo -e "${GREEN}${BAR}${NO_COLOUR}"
else
echo -e "${RED}${BAR}${NO_COLOUR}"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment