# This is a simple build and test pair of commands for InGuardians, using Bust-a-Kube 0.9
# Your mileage may vary.

#
# In the MacOS window:
#
# Compile in a subshell, so we don't lose our current working directory, but can skip pushd-popd, then push to master node.  On a Mac, give audio cue.
( cd ~/go/src/github.com/inguardians/peirates/cmd/peirates/ ; env GOOS=linux GOARCH=amd64 go build peirates.go ) && scp ~/go/src/github.com/inguardians/peirates/cmd/peirates/peirates root@k8s-master-local:.  && say "hack it"

#
# In the Master node window 
# 
export pod=`kubectl get pods | grep frontend | head -1 | awk "{print \\$1}"` ; cat ./peirates | kubectl exec -it $pod -- bash -c "cat >/usr/bin/peirates ; chmod 700 /usr/bin/peirates" ; kubectl exec -it $pod -- /bin/bash
