Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Modified version of marmoset_submit to automagically add a tag in git when submitting, and push the tag to github
#!/bin/bash
if [ $# -lt 3 ]; then
echo "Usage: marmoset_submit course project file [...]"
exit 1
fi
if [ $# -eq 3 ]; then
zip "$3" >& /dev/null
if [ $? -eq 12 ]; then
/u8/cs_build/bin/marmoset_submit "$@"
exit 0;
fi
fi
COURSE="$1"
ASSIGN="$2"
shift
shift
TEMP=`tempfile --suffix=.zip`
rm $TEMP
zip -j $TEMP "$@"
outputfile=`tempfile`
output=`/u8/cs_build/bin/marmoset_submit "$COURSE" "$ASSIGN" $TEMP > "$outputfile" 2>&1`
#output=`cat ~/sedtest>$outputfile`
message=`tail -2 $outputfile|head -n 1`
tag=`echo $message|sed 's/^.*#\([0-9]*\).*\(A[0-9]\w*\).*/\2S\1/'`
echo message: $message
echo ...
echo tag: $tag
echo ...
echo Adding git tag $tag and $message
echo ...
git tag -a -m "$message" $tag
echo Pushing to github
git push --tags
rm $outputfile
rm $TEMP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment