Created
          December 21, 2011 00:52 
        
      - 
      
- 
        Save tjdett/1504020 to your computer and use it in GitHub Desktop. 
    Util for testing - prints green for 0 exit status, otherwise red
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #!/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 | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #!/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