Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 102 lines (82 sloc) 2.3 KB
#!/bin/sh
# Welcome to Matt's laptop script, forked from thoughbot!
# Be prepared to turn your laptop (or desktop, no haters here)
# into an awesome development machine.
fancy_echo() {
local fmt="$1"; shift
# shellcheck disable=SC2059
printf "\n$fmt\n" "$@"
}
# shellcheck disable=SC2154
trap 'ret=$?; test $ret -ne 0 && printf "failed\n\n" >&2; exit $ret' EXIT
set -e
# Create ~/.bin if it doesn't exist
if [ ! -d "$HOME/.bin/" ]; then
mkdir "$HOME/.bin"
fi
# Create ~/.zshrc if it doesn't exist
if [ ! -f "$HOME/.zshrc" ]; then
touch "$HOME/.zshrc"
fi
# Create ~/Code if it doesn't exist
if [ ! -d "$HOME/Code/" ]; then
mkdir "$HOME/Code"
fi
# Create shell to zsh
case "$SHELL" in
*/zsh) : ;;
*)
fancy_echo "Changing your shell to zsh ..."
chsh -s "$(which zsh)"
;;
esac
# Setup SSH public key if it doesn't exist
fancy_echo "Checking for SSH key, generating one if it doesn't exist ..."
[[ -f ~/.ssh/id_rsa.pub ]] || ssh-keygen -t rsa
# Setup Homebrew
if ! command -v brew >/dev/null; then
fancy_echo "Installing Homebrew ..."
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
fancy_echo "Updating Homebrew formulae ..."
brew update
brew bundle --file=- <<EOF
brew "awscli"
brew "git"
brew "go"
brew "heroku"
brew "n"
brew "python"
brew "rbenv"
brew "ruby-build"
brew "z"
brew "zsh-syntax-highlighting"
EOF
fancy_echo "Configuring Ruby ..."
find_latest_ruby() {
rbenv install -l | grep -v - | tail -1 | sed -e 's/^ *//'
}
ruby_version="$(find_latest_ruby)"
eval "$(rbenv init -)"
if ! rbenv versions | grep -Fq "$ruby_version"; then
rbenv install "$ruby_version"
fi
rbenv global "$ruby_version"
rbenv shell "$ruby_version"
gem update --system
fancy_echo "Configuring Node ..."
n lts
n latest
npm install -g npm
npm install -g eslint gulp jshint npm-check-updates pure-prompt xo yarn
fancy_echo "Installing Casks"
brew cask install caskroom/fonts/font-hack caskroom/fonts/font-source-code-pro
brew cask install qlmarkdown qlcolorcode qlstephen quicklook-json qlimagesize
# Get rid of zshrc and move on to the dotfiles
rm ~/.zshrc
fancy_echo "Cloning and installing dotfiles ..."
git clone git@github.com:mattbanks/dotfiles.git ~/.dotfiles
cd ~/.dotfiles
script/bootstrap
fancy_echo "Installing Atom packages"
apm stars --install