#!/bin/sh
rm -rf m3
mkdir m3
GOPATH=`pwd`/m3
export GOPATH
git clone --depth 1 https://github.com/m3db/m3.git $GOPATH/src/github.com/m3db/m3
(   cd $GOPATH/src/github.com/m3db/m3
    git submodule update --init --recursive
    glide install
)
tar cvf - m3 | xz -9 >m3-`date '+%Y%m%d'`.tar.xz
rm -rf m3
