<commit_before>#!/bin/bash


# Setup Homebrew
brew_preinstall() {
  if is-macos; then
    _brew_init
    _brew_update
    _brew_taps
    _brew_update
    _brew_upgrade
  fi
}


_brew_init() {
  local name

  for name in Caskroom Cellar Frameworks etc include lib opt sbin var; do
    if [ ! -d "/usr/local/$name" ]; then
      sudo mkdir "/usr/local/$name"
    fi
    if [ "$(stat -f "%Su" "/usr/local/$name")" != "$(whoami)" ]; then
      sudo chown -R "$(whoami)" "/usr/local/$name"
    fi
  done
}


_brew_update() {
  local opts="$DOTFILES_CONFIG/brew/opts.conf"
  local fg

  fg="$(grep update $opts)"
  fg="${fg##update}"

  if [[ "$fg" = *on* ]]; then
    echo "> brew update"
    brew update || brew update
  fi
}
<commit_msg>fix(pre-brew.bash): add brew install command<commit_after>#!/bin/bash


# Setup Homebrew
brew_preinstall() {
  if is-macos; then
    _brew_init
    _brew_update
    _brew_taps
    _brew_update
    _brew_upgrade
  fi
}


_brew_init() {
  local name
  
  if ! type -p brew > /dev/null 2>&1; then
    /usr/bin/ruby -e \
      "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  fi

  for name in Caskroom Cellar Frameworks etc include lib opt sbin var; do
    if [ ! -d "/usr/local/$name" ]; then
      sudo mkdir "/usr/local/$name"
    fi
    if [ "$(stat -f "%Su" "/usr/local/$name")" != "$(whoami)" ]; then
      sudo chown -R "$(whoami)" "/usr/local/$name"
    fi
  done
}


_brew_update() {
  local opts="$DOTFILES_CONFIG/brew/opts.conf"
  local fg

  fg="$(grep update $opts)"
  fg="${fg##update}"

  if [[ "$fg" = *on* ]]; then
    echo "> brew update"
    brew update || brew update
  fi
}

{'fraction_non_alphanumeric': 0.1583383503913305, 'fraction_numerical': 0.0012040939193257074, 'mean_word_length': 2.6688741721854305, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 1, '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': '4398143', 'n_tokens_mistral': 651, 'n_tokens_neox': 610, 'n_words': 161}