Install as follows
\curl -sSL https://gist.github.com/bf4/38774a5e48660b264bde/download | \
tar xzvf - --include '*setup' -O | bash
#!/usr/bin/env bash | |
function fn_exists { | |
which $1 &> /dev/null | |
cmd_success | |
} | |
# http://stackoverflow.com/questions/5155528/check-if-a-mac-os-x-application-is-present | |
# http://stackoverflow.com/questions/6682335/how-can-check-if-particular-application-software-is-installed-in-mac-os | |
function app_exists { | |
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister \ | |
-dump | grep -i $1 &> /dev/null | |
cmd_success | |
} | |
function cmd_success { | |
[[ $? -eq 0 ]] | |
} | |
function file_exists { | |
[[ -s $1 ]] || [[ -d $1 ]] | |
} | |
function not_file_exists { | |
[[ ! -s $1 ]] && [[ ! -d $1 ]] | |
} | |
function brew_install { | |
if brew list $1 &> /dev/null | |
then | |
echo "already installed $1" | |
false | |
else | |
echo "installing $1" | |
brew install $1 | |
fi | |
} | |
function brew_install_service { | |
brew_install $1 && \ | |
ln -sfv /usr/local/opt/$1/*.plist ~/Library/LaunchAgents && \ | |
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.$1.plist || echo $! | |
} | |
function brew_cask { | |
if brew cask list $1 &> /dev/null | |
then | |
echo "cask already installed $1" | |
false | |
# use cut to support e.g. google-chrome to match com.google.chrome | |
elif app_exists $(echo "$1" | cut -d- -f2) | |
then | |
echo "OMG, the app exists for $1" | |
else | |
echo "installing $1" | |
brew cask install $1 | |
fi | |
} | |
function brew_tap { | |
if brew tap | grep $1 &> /dev/null | |
then | |
echo "already tapped $1" | |
false | |
else | |
echo "tapping $1" | |
brew tap $1 | |
fi | |
} | |
function app_cmd { | |
if [ "$platform" = "vagrant" ] | |
then | |
echo "running command on vagrant: $1" | |
vagrant ssh -c "cd /vagrant && $1" | |
else | |
echo "running command locally: $1" | |
eval $1 | |
fi | |
} | |
function add_to_profile { | |
echo "adding to ~/profile: '$1'" | |
echo $1 >> $HOME/.profile | |
} |
[user] | |
name = | |
email = |
export LANG=en_US.UTF-8 | |
export LC_ALL=en_US.UTF-8 | |
export EDITOR=vim | |
export VISUAL=vim | |
export PAGER=less | |
[[ -s '/usr/local/bin/hub' ]] && alias git=hub | |
export PATH=/usr/local/bin:/usr/bin:/usr/local/sbin:$HOME/bin:$PATH |
#!/usr/bin/env bash | |
mkdir -p /tmp/workstation_bootstrap | |
cd /tmp/workstation_bootstrap | |
\curl -sSL https://gist.github.com/bf4/38774a5e48660b264bde/download | tar xzvf - | |
find . -type f | while read 'x' ; do mv "$x" ./ ; done | |
bash workstation |
#!/usr/bin/env bash | |
source "functions.sh" | |
## RVM | |
## http://rvm.io/ | |
if file_exists "$HOME/.rvm/scripts/rvm" && fn_exists "rvm" | |
then | |
echo "we have rvm; you are using $(ruby --version) from $(which ruby)" | |
else | |
echo "we don't have rvm, installing with mri ruby" | |
\curl -sSL https://get.rvm.io | bash -s stable --ruby | |
source "$HOME/.rvm/scripts/rvm" | |
fi | |
## Homebrew | |
if fn_exists "brew" | |
then | |
echo "we have brew" | |
else | |
echo "installing brew" | |
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)" | |
fi | |
## Git | |
if fn_exists "git" | |
then | |
echo "we have git" | |
else | |
brew_install "git" | |
# The OS X keychain credential helper has been installed to: | |
# /usr/local/bin/git-credential-osxkeychain | |
# | |
# The 'contrib' directory has been installed to: | |
# /usr/local/share/git-core/contrib | |
# | |
# Bash completion has been installed to: | |
# /usr/local/etc/bash_completion.d | |
# | |
# zsh completion has been installed to: | |
# /usr/local/share/zsh/site-functions | |
echo "please run edit your ~/.gitconfig.local per https://github.com/CouponTrade/dotfiles#make-your-own-customizations" | |
if not_file_exists $HOME/.gitconfig.local | |
then | |
cp gitconfig.local $HOME/.gitconfig.local | |
echo "[include]" >> $HOME/.gitconfig | |
echo " path = .gitconfig.local" >> $HOME/.gitconfig | |
fi | |
# ssh keys to github | |
ssh git@github.com 2>&1| grep successfully | |
if [ $? -eq 0 ] | |
then | |
"You are authenticated with github" | |
else | |
if not_file_exists $HOME/.ssh/id_rsa.pub | |
then | |
ssh-keygen | |
fi | |
fi | |
echo "Copy your SSH keys to github if you have not already" | |
echo "See http://help.github.com/mac-set-up-git/" | |
echo "Or just:" | |
echo "cat ~/.ssh/id_rsa.pub | pbcopy" | |
fi | |
## ~/.profile | |
if cat $HOME/.profile | grep "# UPDATED BY WORKSTATION BOOTSTRAP" &> /dev/null | |
then | |
true | |
else | |
add_to_profile "# UPDATED BY WORKSTATION BOOTSTRAP" | |
add_to_profile "source ~/.profile.workstation_bootsrap" | |
cp profile.workstation_bootstrap $HOME/.profile.workstation_bootstrap | |
source $HOME/.profile.workstation_bootstrap | |
fi | |
## Homebrew Cask (for binaries) | |
brew_tap caskroom/cask | |
brew_install "brew-cask" | |
# need firefox for selenium tests | |
if cmd_success brew_cask "firefox" | |
then | |
# ==> Symlinking App 'Firefox.app' to '$HOME/Applications/Firefox.app' | |
ln -s $HOME/Applications/Firefox.app /Applications/ # required for selenium web driver default | |
fi | |
brew_cask "google-chrome" | |
brew_cask "alfred" | |
if cmd_success | |
then | |
# ==> Symlinking App 'Alfred 2.app' to '$HOME/Applications/Alfred | |
# 2.app' | |
# ==> Symlinking App 'Alfred Preferences.app' to | |
# '$HOME/Applications/Alfred Preferences.app' | |
# Help alfred find homebrew_casked items | |
brew_cask "alfred link" | |
# TODO: add to login items | |
fi | |
brew_cask "caffeine" | |
# TODO: add to login items | |
brew_install "hub" | |
# get the nice vim that macvim comes with | |
echo "This may fail if you haven't installed the full XCode." | |
brew_install "macvim" | |
brew_install ctags | |
brew_install tmux | |
brew_install the_silver_searcher # aka 'ag' | |
brew_cask sequel-pro |