<commit_before>#!/usr/bin/env bash

ASDF_DIR="$HOME/.asdf"
OMZSH_DIR="$HOME/.oh-my-zsh"
VUNDLE_DIR="$HOME/.vim/bundle/Vundle.vim"
RUBY_VERSION="2.3.3"
NODE_VERSION="6.9.2"

# Repo setup
if !(cat "$HOME/.git/info/exclude" | grep -q \*$ 2>/dev/null); then
  echo "[setup] Excluding all files from git"
  echo "*" >> "$HOME/.git/info/exclude"
fi

# System flags
echo "[setup] Setting OS X preferences at $HOME/.osx/set_system_flags.sh"
sh "$HOME/.osx/set_system_flags.sh"

# Homebrew
# http://brew.sh
if !(hash brew 2>/dev/null); then
  echo "[setup] Installing homebrew..."
  ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi

# Homebrew bundle
# https://github.com/Homebrew/homebrew-bundle
if !(brew tap | grep -q homebrew/bundle 2>/dev/null); then
  echo "[setup] Installing homebrew/bundle"
  brew tap Homebrew/bundle
fi

# Homebrew deps
echo "[setup] Installing homebrew dependencies"
(cd "$HOME"; brew bundle)

# Asdf version manager
# https://github.com/HashNuke/asdf
if !(test -d "$ASDF_DIR" 2>/dev/null); then
  echo "[setup] Installing asdf"
  git clone https://github.com/HashNuke/asdf.git "$ASDF_DIR"
fi

# Temp add asdf to path
if !(hash asdf 2>/dev/null); then
  export PATH="$ASDF_DIR/bin:$ASDF_DIR/shims:$PATH"
fi

# Ruby version manager plugin
if !(asdf plugin-list | grep -q ruby 2>/dev/null); then
  echo "[setup] Installing asdf plugin for ruby"
  asdf plugin-add ruby https://github.com/HashNuke/asdf-ruby.git
fi

# Nodejs version manager plugin
if !(asdf plugin-list | grep -q nodejs 2>/dev/null); then
  echo "[setup] Installing asdf plugin for nodejs"
  asdf plugin-add nodejs https://github.com/HashNuke/asdf-nodejs.git
fi

# TODO - Swift version manager

# Install ruby version
if !(asdf list ruby | grep -q "$RUBY_VERSION" 2>/dev/null); then
  echo "[setup] Installing ruby $RUBY_VERSION"
  asdf install ruby "$RUBY_VERSION"
fi

# Install nodejs version
if !(asdf list nodejs | grep -q "$NODE_VERSION" 2>/dev/null); then
  echo "[setup] Installing nodejs $NODE_VERSION"
  asdf install nodejs "$NODE_VERSION"
fi

# Set .tool-versions
if !(cat "$HOME/.tool-versions" | grep -q "ruby $RUBY_VERSION" 2>/dev/null); then
  echo "[setup] Setting ruby $RUBY_VERSION in $HOME/.tool-versions"
  echo "ruby $RUBY_VERSION" >> "$HOME/.tool-versions"
fi

if !(cat "$HOME/.tool-versions" | grep -q "nodejs $NODE_VERSION" 2>/dev/null); then
  echo "[setup] Setting nodejs $NODE_VERSION in $HOME/.tool-versions"
  echo "nodejs $NODE_VERSION" >> "$HOME/.tool-versions"
fi

# Bundler/Gems
if !(hash bundle 2>/dev/null); then
  echo "[setup] Installing bundler for ruby $RUBY_VERSION"
  gem install bundler
fi

echo "[setup] Installing global gems from $HOME/.ruby/Gemfile"
bundle install --gemfile="$HOME/.ruby/Gemfile"

# Nodejs packages
echo "[setup] Installing global node packages from $HOME/.node/install-global.sh"
sh "$HOME/.node/install-global.sh"<commit_msg>[setup] handle macOS specific setup<commit_after>#!/usr/bin/env bash

ASDF_DIR="$HOME/.asdf"
OMZSH_DIR="$HOME/.oh-my-zsh"
VUNDLE_DIR="$HOME/.vim/bundle/Vundle.vim"
RUBY_VERSION="2.3.3"
NODE_VERSION="6.9.2"

PLATFORMSTR=$(uname -s)

# Repo setup
if !(cat "$HOME/.git/info/exclude" | grep -q \*$ 2>/dev/null); then
  echo "[setup] Excluding all files from git"
  echo "*" >> "$HOME/.git/info/exclude"
fi

# Mac-specific setup
if [[ "$PLATFORMSTR" == "Darwin" ]]; then
  echo "[setup] Detected macOS installation, running optional mac setup"

  # System flags
  echo "[setup] Setting OS X preferences at $HOME/.osx/set_system_flags.sh"
  sh "$HOME/.osx/set_system_flags.sh"

  # Homebrew
  # http://brew.sh
  if !(hash brew 2>/dev/null); then
    echo "[setup] Installing homebrew..."
    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  fi

  # Homebrew bundle
  # https://github.com/Homebrew/homebrew-bundle
  if !(brew tap | grep -q homebrew/bundle 2>/dev/null); then
    echo "[setup] Installing homebrew/bundle"
    brew tap Homebrew/bundle
  fi

  # Homebrew deps
  echo "[setup] Installing homebrew dependencies"
  (cd "$HOME"; brew bundle)

  # Asdf version manager
  # https://github.com/HashNuke/asdf
  if !(test -d "$ASDF_DIR" 2>/dev/null); then
    echo "[setup] Installing asdf"
    git clone https://github.com/HashNuke/asdf.git "$ASDF_DIR"
  fi

  # Temp add asdf to path
  if !(hash asdf 2>/dev/null); then
    export PATH="$ASDF_DIR/bin:$ASDF_DIR/shims:$PATH"
  fi

  # Ruby version manager plugin
  if !(asdf plugin-list | grep -q ruby 2>/dev/null); then
    echo "[setup] Installing asdf plugin for ruby"
    asdf plugin-add ruby https://github.com/HashNuke/asdf-ruby.git
  fi

  # Nodejs version manager plugin
  if !(asdf plugin-list | grep -q nodejs 2>/dev/null); then
    echo "[setup] Installing asdf plugin for nodejs"
    asdf plugin-add nodejs https://github.com/HashNuke/asdf-nodejs.git
  fi

  # TODO - Swift version manager

  # Install ruby version
  if !(asdf list ruby | grep -q "$RUBY_VERSION" 2>/dev/null); then
    echo "[setup] Installing ruby $RUBY_VERSION"
    asdf install ruby "$RUBY_VERSION"
  fi

  # Install nodejs version
  if !(asdf list nodejs | grep -q "$NODE_VERSION" 2>/dev/null); then
    echo "[setup] Installing nodejs $NODE_VERSION"
    asdf install nodejs "$NODE_VERSION"
  fi

  # Set .tool-versions
  if !(cat "$HOME/.tool-versions" | grep -q "ruby $RUBY_VERSION" 2>/dev/null); then
    echo "[setup] Setting ruby $RUBY_VERSION in $HOME/.tool-versions"
    echo "ruby $RUBY_VERSION" >> "$HOME/.tool-versions"
  fi

  if !(cat "$HOME/.tool-versions" | grep -q "nodejs $NODE_VERSION" 2>/dev/null); then
    echo "[setup] Setting nodejs $NODE_VERSION in $HOME/.tool-versions"
    echo "nodejs $NODE_VERSION" >> "$HOME/.tool-versions"
  fi

  # Bundler/Gems
  if !(hash bundle 2>/dev/null); then
    echo "[setup] Installing bundler for ruby $RUBY_VERSION"
    gem install bundler
  fi

  echo "[setup] Installing global gems from $HOME/.ruby/Gemfile"
  bundle install --gemfile="$HOME/.ruby/Gemfile"

  # Nodejs packages
  echo "[setup] Installing global node packages from $HOME/.node/install-global.sh"
  sh "$HOME/.node/install-global.sh"
fi
{'fraction_non_alphanumeric': 0.14659515683406468, 'fraction_numerical': 0.005850804485616773, 'mean_word_length': 3.811571540265833, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 39, 'https://': 12, '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': '3237918', 'n_tokens_mistral': 2261, 'n_tokens_neox': 2144, 'n_words': 613}