From 9ad56a472e23b3b9119d853d4c9bb23f31f0d255 Mon Sep 17 00:00:00 2001 From: Claudio Ortolina Date: Sun, 12 Oct 2014 12:59:31 +0100 Subject: [PATCH] Rolls back to custom Homebrew packages installer. --- Brewfile | 19 ------------------ install.bash | 35 +++++++++++++++++++++++---------- manifests/homebrew_dependencies | 18 +++++++++++++++++ 3 files changed, 43 insertions(+), 29 deletions(-) delete mode 100644 Brewfile create mode 100644 manifests/homebrew_dependencies diff --git a/Brewfile b/Brewfile deleted file mode 100644 index 156df5e..0000000 --- a/Brewfile +++ /dev/null @@ -1,19 +0,0 @@ -update -install ack -install autojump -install bash -install bash-completion -install ctags -install direnv -install git -install grc -install postgresql -install rbenv -install reattach-to-user-namespace -install ruby-build -install ssh-copy-id -install the_silver_searcher -install tmux -install tree -install vim -install wget diff --git a/install.bash b/install.bash index 0b95ad2..e490ca8 100755 --- a/install.bash +++ b/install.bash @@ -77,6 +77,22 @@ function check_command_dependency () { handle_error $1 'There was a problem with:' } +function install_homebrew () { + log "${notice}Installing ${component}Homebrew ${notice}recipe ${package}$1" + if [ $DEBUG == 0 ]; then + HOMEBREW_OUTPUT=`brew install $1 2>&1` + handle_error $1 "Homebrew had a problem\n($HOMEBREW_OUTPUT):" + fi +} + +function remove_homebrew () { + log "Removing homebrew recipe $1" + if [ $DEBUG == 0 ]; then + HOMEBREW_OUTPUT=`brew uninstall $1 2>&1` + handle_error $1 "Homebrew had a problem while removing\n($HOMEBREW_OUTPUT):" + fi +} + function backup_dotfiles () { log "${notice}Backing up your dotfiles" customise_manifest @@ -89,19 +105,20 @@ function backup_dotfiles () { log "${notice}Your dotfiles are now backed up to $filename$BACKUP_FILE" } -function check_homebrew_version () { - cd $(brew --prefix) - count=$(git rev-list HEAD --count) - if [ $count -lt 25122 ]; then - handle_error "You need to update Homebrew to support .brewfile" +function homebrew_checkinstall_recipe () { + brew list $1 &> /dev/null + if [ $? == 0 ]; then + log "${success}Your $package$1 ${success}installation is fine. Doing nothing" + else + install_homebrew $1 fi - cd - 2>&1 >/dev/null } function homebrew_dependencies () { log "${notice}Installing ${component}Homebrew ${notice}dependencies. This may take a while" - cd $INSTALL_DIR - brew bundle + while read recipe; do + homebrew_checkinstall_recipe $recipe + done < "$INSTALL_DIR/manifests/homebrew_dependencies" } function install_vundle () { @@ -132,8 +149,6 @@ function set_hermes_path () { log "${attention}Starting ${hermes} ${attention}installation" -check_homebrew_version - backup_dotfiles install_vundle diff --git a/manifests/homebrew_dependencies b/manifests/homebrew_dependencies new file mode 100644 index 0000000..31c8a4c --- /dev/null +++ b/manifests/homebrew_dependencies @@ -0,0 +1,18 @@ +ack +autojump +bash +bash-completion +ctags +direnv +git +grc +jq +rbenv +reattach-to-user-namespace +ruby-build +ssh-copy-id +the_silver_searcher +tmux +tree +vim +wget