Skip to content

Instantly share code, notes, and snippets.

@kyl191
Last active October 12, 2015 16:37
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save kyl191/4055681 to your computer and use it in GitHub Desktop.
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