#!/bin/bash
tag=v0.1.21
set -e
tmp=$(mktemp -d)
trap cleanup EXIT
cleanup() {
set +e
[ -z "$tmp" -o ! -d "$tmp" ] || rm -rf "$tmp"
}
unset CDPATH
pwd=$(pwd)
pushd "$tmp"
git clone https://github.com/montagejs/collections.git
cd collections
git archive --prefix="spec/" --format=tar tags/${tag}:spec/ \
| bzip2 > "$pwd"/spec-${tag}.tar.bz2
popd