#!/bin/bash

set -euo pipefail


SCRIPT_DIR=$(dirname $0)
DRIVING_ROOT=$(dirname $(dirname ${SCRIPT_DIR}))
OS=$(uname | tr '[:upper:]'  '[:lower:]')
set -x
if [[ $OS == "linux" ]]
then
  ${DRIVING_ROOT}/scripts/setup/setup.sh dev --tags python_dev_deps
fi

if [[ $OS == "darwin" ]]
then
  if [[ ! -x "$(command -v brew)" ]]
  then
    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  fi
  if [[ ! -x "$(command -v ansible)" ]]
  then
    brew install ansible
  fi
fi
ansible-playbook --inventory-file /dev/null ${SCRIPT_DIR}/setup-kube-access.yml "$@"
set +x
cat <<'EOF'
****************************************************************************
*                                                                          *
* Setup complete. Please make sure you have $HOME/.local/bin in your PATH. *
*                                                                          *
****************************************************************************
EOF
