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

RUBY_INSTALL_VERSION="0.1.0"

#
# Set SRC_DIR and INSTALL_DIR based on the priviledges of the user.
#
if [[ $UID -eq 0 ]]; then
	[[ -n "$SRC_DIR"     ]] || SRC_DIR="/usr/local/src"
	[[ -n "$INSTALL_DIR" ]] || INSTALL_DIR="/usr/local"
else
	[[ -n "$SRC_DIR"     ]] || SRC_DIR="$HOME/src"
	[[ -n "$INSTALL_DIR" ]] || INSTALL_DIR="$HOME/.local"
fi

RUBIES=(ruby jruby rubinius)

declare -a PATCHES
declare -a CONFIGURE_OPTS

#
# Prints a log message.
#
function log()
{
	if [[ -t 1 ]]; then
		echo -e "\x1b[1m\x1b[32m>>>\x1b[0m \x1b[1m\x1b[37m$1\x1b[0m"
	else
		echo ">>> $1"
	fi
}

#
# Prints a warn message.
#
function warn()
{
	if [[ -t 1 ]]; then
		echo -e "\x1b[1m\x1b[33m***\x1b[0m \x1b[1m\x1b[37m$1\x1b[0m" >&2
	else
		echo "*** $1" >&2
	fi
}

#
# Prints an error message.
#
function error()
{
	if [[ -t 1 ]]; then
		echo -e "\x1b[1m\x1b[31m!!!\x1b[0m \x1b[1m\x1b[37m$1\x1b[0m" >&2
	else
		echo "!!! $1" >&2
	fi
}

#
# Prints an error message and exists with -1.
#
function fail()
{
	error "$*"
	exit -1
}

#
# Searches a file for a key and echos the value.
# If the key cannot be found, the third argument will be echoed.
#
function fetch()
{
	local pair=$(grep -E "^$2: " "$RUBY_DIR/$1.txt")
	local value=${pair#$2:}
<commit_msg>Strip the space after the ':'.<commit_after>#!/usr/bin/env bash

RUBY_INSTALL_VERSION="0.1.0"

#
# Set SRC_DIR and INSTALL_DIR based on the priviledges of the user.
#
if [[ $UID -eq 0 ]]; then
	[[ -n "$SRC_DIR"     ]] || SRC_DIR="/usr/local/src"
	[[ -n "$INSTALL_DIR" ]] || INSTALL_DIR="/usr/local"
else
	[[ -n "$SRC_DIR"     ]] || SRC_DIR="$HOME/src"
	[[ -n "$INSTALL_DIR" ]] || INSTALL_DIR="$HOME/.local"
fi

RUBIES=(ruby jruby rubinius)

declare -a PATCHES
declare -a CONFIGURE_OPTS

#
# Prints a log message.
#
function log()
{
	if [[ -t 1 ]]; then
		echo -e "\x1b[1m\x1b[32m>>>\x1b[0m \x1b[1m\x1b[37m$1\x1b[0m"
	else
		echo ">>> $1"
	fi
}

#
# Prints a warn message.
#
function warn()
{
	if [[ -t 1 ]]; then
		echo -e "\x1b[1m\x1b[33m***\x1b[0m \x1b[1m\x1b[37m$1\x1b[0m" >&2
	else
		echo "*** $1" >&2
	fi
}

#
# Prints an error message.
#
function error()
{
	if [[ -t 1 ]]; then
		echo -e "\x1b[1m\x1b[31m!!!\x1b[0m \x1b[1m\x1b[37m$1\x1b[0m" >&2
	else
		echo "!!! $1" >&2
	fi
}

#
# Prints an error message and exists with -1.
#
function fail()
{
	error "$*"
	exit -1
}

#
# Searches a file for a key and echos the value.
# If the key cannot be found, the third argument will be echoed.
#
function fetch()
{
	local pair=$(grep -E "^$2: " "$RUBY_DIR/$1.txt")
	local value=${pair#$2: }

{'fraction_non_alphanumeric': 0.20703125, 'fraction_numerical': 0.05, 'mean_word_length': 3.226072607260726, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 23, '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': '1864800', 'n_tokens_mistral': 1295, 'n_tokens_neox': 1227, 'n_words': 295}