diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..09e4c05 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +*.scpt filter=ascr + diff --git a/scripts/git-ascr-filter b/scripts/git-ascr-filter new file mode 100755 index 0000000..0605eb7 --- /dev/null +++ b/scripts/git-ascr-filter @@ -0,0 +1,30 @@ +#!/bin/sh +if [ $# -ne 2 ]; then + echo "Usage: $0 --clean/--smudge FILE">&2 + exit 1 +else + if [ "$1" = "--clean" ]; then + osadecompile "$2" | sed 's/[[:space:]]*$//' + elif [ "$1" = "--smudge" ]; then + TMPFILE=`mktemp -t tempXXXXXX` + if [ $? -ne 0 ]; then + echo "Error: \`mktemp' failed to create a temporary file.">&2 + exit 3 + fi + if ! mv "$TMPFILE" "$TMPFILE.scpt" ; then + echo "Error: Failed to create a temporary SCPT file.">&2 + rm "$TMPFILE" + exit 4 + fi + TMPFILE="$TMPFILE.scpt" + # Compile the AppleScript source on stdin. + if ! osacompile -l AppleScript -o "$TMPFILE" ; then + rm "$TMPFILE" + exit 5 + fi + cat "$TMPFILE" && rm "$TMPFILE" + else + echo "Error: Unknown mode '$1'">&2 + exit 2 + fi +fi diff --git a/thingspy/mailToThings.scpt b/thingspy/mailToThings.scpt index 39c45e4..5b74db1 100644 Binary files a/thingspy/mailToThings.scpt and b/thingspy/mailToThings.scpt differ