Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- export ERRFILE=$(mktemp)
- export PATH="/usr/bin:/bin"
- export REPOS="$1"
- export TMPFILE=$(mktemp)
- export TXN="$2"
- svnlook changed -t "$TXN" "$REPOS" \
- | awk '{print $2}' \
- | \
- while read LINE; do
- svnlook cat -t "$TXN" "$REPOS" "$LINE" > "$TMPFILE"
- if [ $? -ne 0 ]; then
- echo "Warning: Failed to checkout $LINE" >&2
- exit -100
- fi
- EXT=$(echo $LINE | awk -F'.' '{ print $NF }')
- case "$EXT" in
- "erb")
- erb -x -T '-' $TMPFILE | ruby -c
- if [ $? -ne 0 ]; then
- echo "ERB parsing error in $LINE:" >&2
- cat $ERRFILE >&2
- exit 2
- fi
- ;;
- "pp")
- /usr/bin/puppet --color=false --parseonly $TMPFILE >$ERRFILE 2>/dev/null
- if [ -s $ERRFILE ]; then
- echo "Puppet syntax error in $LINE:" >&2
- cat $ERRFILE >&2
- exit 2
- fi
- ;;
- "rb")
- ruby -c $TMPFILE >$ERRFILE 2>/dev/null
- if [ $? -ne 0 ]; then
- echo "Bash syntax error in $LINE:" >&2
- cat $ERRFILE >&2
- exit 2
- fi
- ;;
- "sh")
- bash -n $TMPFILE >$ERRFILE 2>/dev/null
- if [ -s $ERRFILE ]; then
- echo "Bash syntax error in $LINE:" >&2
- cat $ERRFILE >&2
- exit 2
- fi
- ;;
- *)
- continue
- ;;
- esac
- rm -f "$ERRFILE" "$TMPFILE"
- done
- exit 0
Add Comment
Please, Sign In to add comment