Author: bdonlan
Date: 2005-01-07 18:25:25 -0500 (Fri, 07 Jan 2005)
New Revision: 545

Modified:
   /
   trunk/web/Makefile
   trunk/web/bin/validator.sh
Log:
 [EMAIL PROTECTED]:  bdonlan | 2005-01-07T23:24:55.803566Z
 * validator.sh:
   We now cache the valid state of files, so we only have to revalidate files
   which have changed. Also various other UI tweaks.
 * Makefile
   Hide the command line uses to run the validator
 



Property changes on: 
___________________________________________________________________
Name: svk:merge
   - 1f59643a-e6e5-0310-bc24-f7d4c744f460:/haver/local:11227
   + 1f59643a-e6e5-0310-bc24-f7d4c744f460:/haver/local:11235

Modified: trunk/web/Makefile
===================================================================
--- trunk/web/Makefile  2005-01-07 23:05:30 UTC (rev 544)
+++ trunk/web/Makefile  2005-01-07 23:25:25 UTC (rev 545)
@@ -60,7 +60,7 @@
        rm -vf $(targets)
 
 validate: $(html)
-       $(VALIDATE) $(html)
+       @$(VALIDATE) $(html)
 
 test: validate
 

Modified: trunk/web/bin/validator.sh
===================================================================
--- trunk/web/bin/validator.sh  2005-01-07 23:05:30 UTC (rev 544)
+++ trunk/web/bin/validator.sh  2005-01-07 23:25:25 UTC (rev 545)
@@ -1,7 +1,38 @@
 #!/bin/bash
+ALLOK=yes
+for file in "$@"; do
+       VALIDMARKER="$(dirname "$file")/.$(basename "$file" .html).valid"
+       if [ "$VALIDMARKER" -nt "$file" ]; then
+               continue
+       fi
+       
+       rm -f "$VALIDMARKER"
+       
+       printf "CHECK\t$file\n"
+       if which validate &>/dev/null; then
+               validate "$file"
+               RESULT=$?
+       elif which xmllint &>/dev/null; then
+               xmllint --valid --noout "$file"
+               RESULT=$?
+       else
+               echo "Cannot find either validate or xmllint."
+               exit 1
+       fi
 
-if which validate &>/dev/null; then
-    validate "$@"
-elif which xmllint &>/dev/null; then
-    xmllint --valid --noout "$@"
+       if [ $RESULT == 0 ]; then
+               printf "OK\t$file\n"
+               touch "$VALIDMARKER"
+       else
+               ALLOK=no
+               printf "FAIL\t$file\n"
+       fi
+done
+
+if [ $ALLOK == yes ]; then
+       echo All files validated successfully.
+       exit 0
+else
+       echo One or more files failed to validate. See above messages.
+       exit 1
 fi


Reply via email to