<commit_before>#!/bin/bash

# This cannot be executed from within a Ruby-based environment (like Rake)
# since Bundler will affect the subshell environments.

set -e

function header() {
  echo -e "\n$1:\n======================================="
}

if [[ $1 == "install" ]]; then
  header "Installing gem dependencies"
  bundle install --quiet && echo "OK"

  for app in spec/railsapps/*; do
    (
      cd $app
      header "Installing gems for $app"
      bundle install --quiet && echo "OK"
    )
  done
  echo ""

elif [[ $1 == "update" ]]; then
  header "Updating gem dependencies"
  bundle update

  for app in spec/railsapps/*; do
    (
      cd $app
      header "Updating $app"
      bundle update
    )
  done
  echo ""

else
  echo "Usage: $0 [install|update]"
  echo ""
  echo "  Install: Install all bundled updates."
  echo "  Update: Run bundle update on all bundles."
  echo ""
  exit 127
fi<commit_msg>Improve setup script<commit_after>#!/bin/bash

# This cannot be executed from within a Ruby-based environment (like Rake)
# since Bundler will affect the subshell environments.

set -e

function header() {
  echo -e "\n$(tput setaf 5)$(tput smul)$1:$(tput sgr0)"
}

function green() {
  echo $(tput setaf 2)$@$(tput sgr0)
}

function update() {
  bundle update | grep -ve "^Using "
}

function install() {
  bundle install --quiet && green "  OK"
}

root=$(dirname $0)

if [[ $1 == "install" ]]; then
  header "Installing gem dependencies"
  install

  for app_path in $root/spec/railsapps/*; do
    (
      cd $app_path
      header "Installing gems for $(basename $app_path)"
      install
    )
  done
  echo ""

elif [[ $1 == "update" ]]; then
  header "Updating gem dependencies"
  update

  for app_path in $root/spec/railsapps/*; do
    (
      cd $app_path
      header "Updating $(basename $app_path)"
      update
    )
  done
  echo ""

else
  echo "Usage: $0 [install|update]"
  echo ""
  echo "  Install: Install all bundled updates."
  echo "  Update: Run bundle update on all bundles."
  echo ""
  exit 127
fi
{'fraction_non_alphanumeric': 0.14145863925599608, 'fraction_numerical': 0.00930004894762604, 'mean_word_length': 2.9082217973231357, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '4906966', 'n_tokens_mistral': 696, 'n_tokens_neox': 659, 'n_words': 234}