Created
May 29, 2019 14:09
-
-
Save atipapp/b2fba7cf562fde344a406b52b2d0a572 to your computer and use it in GitHub Desktop.
Install git, maven, java11 and Spring Tools Suite for macOS
This file contains hidden or 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
#!/usr/bin/env bash | |
#------------------------------------------------------------------------------ | |
YEL='\033[1;33m' | |
CYN='\033[0;36m' | |
GRN='\033[1;32m' | |
RED='\033[1;31m' | |
NRM='\033[0m' | |
function log { | |
echo -e "${CYN}[${FUNCNAME[1]}]${NRM} $*" | |
} | |
function install_darwin_deps { | |
log "Checking for external dependency: brew" | |
if [[ -z "$(which brew)" && -n "$(which ruby)" ]]; then | |
log "'brew' installer not found, attempting to install..." | |
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
log "'brew' installation completed." | |
fi | |
if [[ "$FORCE" == true ]]; then | |
log "Updating 'brew'..." | |
brew update | |
fi | |
#-- GIT: | |
log "Installing/updating external dependency: git" | |
if [[ -z "$(which git)" ]]; then | |
brew install git | |
elif [[ "$FORCE" == true ]]; then | |
brew upgrade git | |
fi | |
#-- Maven: | |
log "Installing/updating external dependency: maven" | |
if [[ -z "$(which git)" ]]; then | |
brew install maven | |
elif [[ "$FORCE" == true ]]; then | |
brew upgrade maven | |
fi | |
#-- Java11: | |
log "Installing/updating external dependency: java11" | |
if [[ -z "$(which java)" ]]; then | |
brew cask install java11 | |
elif [[ "$FORCE" == true ]]; then | |
brew cask reinstall java11 | |
fi | |
#-- Spring Tools Suite: | |
log "Installing/updating external dependency: Spring Tools Suite" | |
if [[ -n "$FORCE" ]] | |
then | |
brew cask reinstall springtoolsuite | |
else | |
brew cask install springtoolsuite | |
fi | |
} | |
function print_help(){ | |
echo "Use --force to reinstall required dependencies." | |
} | |
while [[ "$#" > 0 ]]; do case $1 in | |
--force) export FORCE=true; shift;; | |
-h | --help) print_help; exit 0;; | |
*) echo "Unknown parameter: $1"; exit 1;; | |
esac; shift; done | |
install_darwin_deps |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment