SHELL := /bin/bash
export PATH := $(CURDIR)/_tools/bin:$(PATH)

sandstorm: check-gopath
	@go get code.justin.tv/systems/sandstorm-agent
	@mkdir -p development/sandstorm
	@sed -e "s|__GOPATH__|$$GOPATH|g" sandstorm_config.template > development/sandstorm/config
	$$GOPATH/bin/sandstorm-agent run development/sandstorm
	@rm -rf development

check-gopath:
	@if [[ -z "$$GOPATH" ]]; then echo "GOPATH is not set"; exit 1; fi

setup:
	# Setup
	GOPATH=$(CURDIR)/_tools go install all # build source files in _tools to _tools/bin

upgrade: setup
	# Upgrade glide dependencies
	glide update --strip-vendor
	glide-vc --only-code --no-tests --use-lock-file
