#!/bin/bash

#########################
#   Get build scripts   #
#########################

BUILD_SCRIPT_VERSION=0.1.13

# Remove the build directory if it exists.
if [ -d ".build" ]; then
   rm -rf .build
fi

# Perform a sparse checkout of the build.py file
mkdir .build && cd .build
git init
git remote add -f --tags origin git@github.com:HourlyNerd/hn-build-scripts.git
git config core.sparsecheckout true

echo build.py > .git/info/sparse-checkout

# Actually check out the tag
git checkout $BUILD_SCRIPT_VERSION
cd ..

#########################
#   Spin up virtualenv  #
#########################

# Remember to run this script via 'source' instead of direct invocation
# to drop you into a virtual env.
if [ -x "/usr/local/bin/virtualenv" ]; then
   virtualenv .env
   . .env/bin/activate
fi
