Skip to content

Instantly share code, notes, and snippets.

@bltavares
Last active December 31, 2015 05:59
Show Gist options
  • Save bltavares/9be6cb19dc4ab9ec895e to your computer and use it in GitHub Desktop.
Save bltavares/9be6cb19dc4ab9ec895e to your computer and use it in GitHub Desktop.

Setup tools

curl -s https://gist.github.com/bltavares/9be6cb19dc4ab9ec895e/raw/bootstrap.sh | bash
#!/bin/bash
bootstrap() {
check_and_install_xcode
check_and_install_homebrew
check_and_install_homebrew_cask
check_and_install_virtualbox
check_and_install_vagrant
check_and_install_nodejs
check_and_install_foreman
# brew cask install sublime-text
# brew cask install iterm2
}
check_for_xcode() {
local XCODE=`which xcode-select`
if [ $XCODE"x" = "x" ]; then
echo "Xcode is not installed"
echo "This require manual setup"
echo "Go on the App Store and install XCODE (FREE)"
echo "Press enter to continue when you are finished"
echo "Or CTRL-C to cancel"
read < /dev/tty
check_for_xcode
fi
}
install_xcode() {
xcode-select --install
echo "Press enter when finished"
read < /dev/tty
}
check_and_install_xcode() {
check_for_xcode
install_xcode
}
check_for_brew() {
local BREW=`which brew`
if [ $BREW"x" = "x" ]; then
echo "Installing Homebrew <http://brew.sh/>"
echo "It will setup using the default installation instructions"
return 1
fi
echo "Homebrew already installed. Using your setup"
return 0
}
install_brew() {
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go/install)"
}
check_and_install_homebrew() {
check_for_brew || install_brew
}
check_for_cask() {
if ! brew info brew-cask > /dev/null 2>&1 ; then
echo "Homebrew-cask <https://github.com/phinze/homebrew-cask> not found."
echo "Installing it."
return 1
fi
echo "Homebrew-cask already installed. Using your setup"
return 0
}
setup_brew_cask() {
brew tap phinze/homebrew-cask
brew install brew-cask
}
check_and_install_homebrew_cask() {
check_for_cask || setup_brew_cask
}
check_virtualbox() {
local VIRTUALBOX=`which VirtualBox`
if [ $VIRTUALBOX"x" = "x" ]; then
echo "Virtualbox not installed. Installing it"
return 1
fi
echo "Virtualbox already installed. Using your setup"
return 0
}
install_virtualbox() {
brew cask install virtualbox
}
check_and_install_virtualbox() {
check_virtualbox || install_virtualbox
}
check_vagrant() {
local VAGRANT=`which vagrant`
if [ $VAGRANT"x" = "x" ]; then
echo "Vagrant not installed. Installing it"
return 1
fi
echo "Vagrant already installed. Using your setup"
return 0
}
install_vagrant() {
brew cask install vagrant
}
check_and_install_vagrant() {
check_vagrant || install_vagrant
}
check_nodejs() {
local NODEJS=`which node`
if [ $NODEJS"x" = "x" ]; then
echo "Nodejs not installed. Installing it"
return 1
fi
echo "Nodejs already installed. Using your setup"
return 0
}
install_nodejs() {
brew install nodejs
}
check_and_install_nodejs() {
check_nodejs || install_nodejs
}
check_foreman() {
local FOREMAN=`which foreman`
if [ $FOREMAN"x" = "x" ]; then
echo "Foreman not installed. Installing it"
return 1
fi
echo "Foreman already installed. Using your setup"
return 0
}
install_foreman() {
gem install foreman --no-ri --no-rdoc
if which rbenv; then
rbenv rehash
fi
}
check_and_install_foreman() {
echo "Assuming you have ruby setup (either using Mac's ruby, rbenv or rvm)" # I recommend rbenv
check_foreman || install_foreman
}
bootstrap
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment