#!/usr/bin/env bash # Description: # one-off convenience command to initialize terminal. # Usage: # $ source setenv export MACHINE_NAME='prototyper' export COMPOSE_PROJECT_NAME=${MACHINE_NAME} # make ops_home easily available to other scripts #export OPS_HOME=$PWD/operations #source ${OPS_HOME}/utils/echo.sh # shared settings NOT added to git if [ -f ./setenv.shared ]; then source ./setenv.shared fi # private settings NOT added to git if [ -f ./setenv.${USER} ]; then source ./setenv.${USER} fi if [ -f ./.version ]; then export $(cat ./.version | xargs) fi # Isolate node for this project by setting N_PREFIX # and adding N_PATH to PATH (see https://github.com/tj/n) export N_PREFIX=${CI_N_PREFIX:=${HOME}/.n/$(basename ${PWD})} N_PATH=${N_PREFIX}/bin case ":$PATH:" in *":$N_PATH:"*) :;; # already there *) export PATH="$N_PATH:$PATH";; # or PATH="$PATH:$new_entry" esac # add ${HOME}/bin to PATH LOCAL_BIN=${PWD}/bin case ":$PATH:" in *":$LOCAL_BIN:"*) :;; # already there *) export PATH="$LOCAL_BIN:$PATH";; # or PATH="$PATH:$new_entry" esac # ensure correct node version node_version=$(cat ./package.json | grep engine | grep -oe "[0-9]\+.[0-9]\+.[0-9]\+" || echo "") if [ "${node_version}x" != "x" ]; then if [ $(command -v n) ]; then n ${node_version} hash -r else echo "please install n ( https://github.com/tj/n ) in one of following ways:" echo "npm install -g n" echo "or" echo "# http://brew.sh" echo "brew install n" echo "or" echo "# https://github.com/mklement0/n-install" echo "curl -L http://git.io/n-install | bash" fi fi #./bootstrap.sh && \ #eval "$(docker-machine env ${MACHINE_NAME})" || \ #echo_error "running bootstrap.sh" #echo_info Setting environment for docker-machine ${bold}${MACHINE_NAME}${normal} #eval "$(docker-machine env ${MACHINE_NAME})" #alias docker-image-tree="docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock nate/dockviz images -t"