<commit_before>#!/bin/sh

if [ ! -d /usr/local/Cellar ]; then
    /usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
    brew doctor
fi

brew install \
    grc \
    coreutils \
    dos2unix \
    wget \
    rbenv \
    pstree<commit_msg>Update homebrew/cask/mas defaults<commit_after>#!/bin/sh

if [ ! -d /usr/local/Cellar ]; then
    /usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
    brew doctor
fi

brew_install_or_upgrade() {
  if brew_is_installed "$1"; then
    if brew_is_upgradable "$1"; then
      brew upgrade "$@"
    fi
  else
    brew install "$@"
  fi
}

brew_is_installed() {
  local name
  name="$(brew_expand_alias "$1")"

  brew list -1 | grep -Fqx "$name"
}

brew_is_upgradable() {
  local name
  name="$(brew_expand_alias "$1")"

  ! brew outdated --quiet "$name" >/dev/null
}

brew_expand_alias() {
  brew info "$1" 2>/dev/null | head -1 | awk '{gsub(/.*\//, ""); gsub(/:/, ""); print $1}'
}

cask_install_or_upgrade() {
}

# Core tools
brew_install_or_upgrade 'grc'
brew_install_or_upgrade 'coreutils'
brew_install_or_upgrade 'dos2unix'
brew_install_or_upgrade 'wget'
brew_install_or_upgrade 'pstree'
brew_install_or_upgrade 'docker'
brew_install_or_upgrade 'dlite'
brew_install_or_upgrade 'netcat'
brew_install_or_upgrade 'argon/mas/mas'

# Github tools
brew_install_or_upgrade 'hub'

# Imaging tools
brew_install_or_upgrade 'pngcrush'

# Python tools
brew_install_or_upgrade 'python'
brew_install_or_upgrade 'numpy'

# Ruby tools
brew_install_or_upgrade 'rbenv'
brew_install_or_upgrade 'ruby-build'
brew_install_or_upgrade 'phantomjs'

# Java tools
brew_install_or_upgrade 'gradle'
brew_install_or_upgrade 'maven'

# Node tools
brew_install_or_upgrade 'node'

# Heroku tools
brew_install_or_upgrade 'heroku-toolbelt'

# Electron windows installer builder tools
brew_install_or_upgrade 'wine'
brew_install_or_upgrade 'mono'
brew_install_or_upgrade 'makensis'

# Databases
brew_install_or_upgrade 'postgres'
brew_install_or_upgrade 'postgis'
brew_install_or_upgrade 'redis'

# Casks
brew cask install --appdir="/Applications" 'spotify'
brew cask install --appdir="/Applications" 'vlc'
brew cask install --appdir="/Applications" 'java'
brew cask install --appdir="/Applications" 'dropbox'
brew cask install --appdir="/Applications" 'firefox'

# Mac App Store apps
mas install 406056744 # Evernote
mas install 425424353 # The Unarchiver
mas install 635758264 # Calca
mas install 497799835 # Xcode
mas install 880001334 # Reeder
mas install 435003921 # Fantastical
mas install 412056820 # Trillian
mas install 803453959 # Slack
mas install 420212497 # Byword
mas install 504544917 # Clear
mas install 448003584 # Simplify
mas install 458034879 # Dash
{'fraction_non_alphanumeric': 0.10963944076526858, 'fraction_numerical': 0.0437821927888153, 'mean_word_length': 4.772823779193206, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7508636', 'n_tokens_mistral': 1111, 'n_tokens_neox': 968, 'n_words': 238}