1#! /bin/bash
2VERSION=$1
3SOURCE=clasp-$VERSION.tar
4git archive --prefix=clasp-$VERSION/ -o $SOURCE origin/dev
5echo Running git archive submodules...
6p=`pwd` && (echo .; git submodule foreach) | while read entering path; do \
7	temp="${path%\'}"; \
8	temp="${temp#\'}"; \
9	path=$temp; \
10	[ "$path" = "" ] && continue; \
11	(cd $path && git archive --prefix=clasp-$VERSION/$path/ HEAD > $p/tmp.tar && tar --concatenate --file=$p/$SOURCE $p/tmp.tar && rm $p/tmp.tar); \
12done
13gzip $SOURCE
14
15