Last active
March 10, 2016 21:21
-
-
Save jg75/a31ff5c827d95e88e5b4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# Override by passing whatever you want | |
REPO_HOME=$HOME/Work | |
if [ $# -eq 1 ] | |
then | |
REPO_HOME=$1 | |
fi | |
brew update | |
for FORMULA in elasticsearch17 mongodb rabbitmq mongodb redis sqlite python python3 go | |
do | |
brew install --upgrade $FORMULA | |
brew link $FORMULA | |
done | |
mkdir -p $REPO_HOME/go/bin | |
mkdir -p $REPO_HOME/go/pkg | |
mkdir -p $REPO_HOME/go/src/github.com/AmberEngine | |
if [ ! -d $REPO_HOME/go/src/github.com/AmberEngine/api ] | |
then | |
[ -e $REPO_HOME/go/src/github.com/AmberEngine/api ] && | |
rm -rf $REPO_HOME/go/src/github.com/AmberEngine/api | |
else | |
cd $REPO_HOME/go/src/github.com/AmberEngine/api | |
if ! git rev-parse --branch > /dev/null 2>&1 | |
then | |
cd - | |
rm -rf $REPO_HOME/go/src/github.com/AmberEngine/api | |
else | |
cd - | |
fi | |
fi | |
if [ ! -d $REPO_HOME/go/src/github.com/AmberEngine/api ] | |
then | |
git clone [email protected]:AmberEngine/api.git | |
fi | |
if [ ! -s $REPO_HOME/api ] | |
then | |
[ -e $REPO_HOME/api ] && | |
rm -rf $REPO_HOME/api | |
ln -s $REPO_HOME/go/src/github.com/AmberEngine/api $REPO_HOME/api | |
fi | |
# Virtualenv | |
VENV_WRAPPER=$(which virtualenvwrapper.sh) | |
if [ ! -z $VENV_WRAPPER ] && [ -s $VENV_WRAPPER ] | |
then | |
. $VENV_WRAPPER | |
fi | |
rmvirtualenv api | |
mkvirtualenv --python=$(which python3) api | |
deactivate | |
cat <<! | |
# This stuff should be in your ~/.bash_profile | |
export GOROOT=$(brew --cellar go)/1.5.3/libexec | |
export GOPATH=$REPO_HOME | |
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin | |
# refreshdb's and deploy | |
# e.g. | |
workon devops-scripts | |
cd $REPO_HOME/devops-scripts/aws | |
fab local_refreshdb:app=api | |
fab local_deploy:app=api | |
fab local_refreshdb:app=channel-manager | |
fab local_deploy:app=channel-manager | |
cd - | |
deactivate | |
! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment