<commit_before>#!/bin/bash

# Get the canonical path to the directory containing the script (following any links to the source file)
if [[ -z $(readlink $0) ]]; then
        TARGET=$0
else
        TARGET="$(dirname $0)/$(readlink $0)"
fi
SOURCE_DIR=$(cd $(dirname $TARGET); pwd)

# Make a fresh bin directory in the same directory as this script
if [[ -d $SOURCE_DIR/bin ]]; then
	rm -r $SOURCE_DIR/bin
fi
mkdir $SOURCE_DIR/bin

# Check if we're using Chef 10.x (which uses CouchDB). Set the VERSION_DIR appropriately.
COUCHDB_VERSION=$(couchdb -V 2>/dev/null | grep -E "couchdb - Apache CouchDB" | sed "s/[^0-9\.]*//")
if [[ -n $COUCHDB_VERSION ]]; then
	CHECK_CHEF_10=$(curl $(cat /var/lib/couchdb/$COUCHDB_VERSION/couch.uri)"_all_dbs" 2>/dev/null | grep chef)
fi

if [[ -z $CHECK_CHEF_10 ]]; then
	VERSION_DIR=chef-11
	echo "Currently, only Chef 10.x servers are supported!"
	exit 1
else
	VERSION_DIR=chef-10
fi

# Make our symbolic links to the version specific scripts off of the base directory
for f in $SOURCE_DIR/$VERSION_DIR/bin/*
do
	(cd $SOURCE_DIR/bin; ln -s ../$VERSION_DIR/bin/$(basename $f) $(basename $f))
done

# Info on installing to /usr/local/bin via the stow package
echo "If you have stow installed (apt-get install stow), you can create links in /usr/local via:"
echo
if [[ $(dirname $SOURCE_DIR) -ne "/usr/local/stow" ]]; then<commit_msg>Fix if condition in setup.sh.<commit_after>#!/bin/bash

# Get the canonical path to the directory containing the script (following any links to the source file)
if [[ -z $(readlink $0) ]]; then
        TARGET=$0
else
        TARGET="$(dirname $0)/$(readlink $0)"
fi
SOURCE_DIR=$(cd $(dirname $TARGET); pwd)

# Make a fresh bin directory in the same directory as this script
if [[ -d $SOURCE_DIR/bin ]]; then
	rm -r $SOURCE_DIR/bin
fi
mkdir $SOURCE_DIR/bin

# Check if we're using Chef 10.x (which uses CouchDB). Set the VERSION_DIR appropriately.
COUCHDB_VERSION=$(couchdb -V 2>/dev/null | grep -E "couchdb - Apache CouchDB" | sed "s/[^0-9\.]*//")
if [[ -n $COUCHDB_VERSION ]]; then
	CHECK_CHEF_10=$(curl $(cat /var/lib/couchdb/$COUCHDB_VERSION/couch.uri)"_all_dbs" 2>/dev/null | grep chef)
fi

if [[ -z $CHECK_CHEF_10 ]]; then
	VERSION_DIR=chef-11
	echo "Currently, only Chef 10.x servers are supported!"
	exit 1
else
	VERSION_DIR=chef-10
fi

# Make our symbolic links to the version specific scripts off of the base directory
for f in $SOURCE_DIR/$VERSION_DIR/bin/*
do
	(cd $SOURCE_DIR/bin; ln -s ../$VERSION_DIR/bin/$(basename $f) $(basename $f))
done

# Info on installing to /usr/local/bin via the stow package
echo "If you have stow installed (apt-get install stow), you can create links in /usr/local via:"
echo
if [[ "$(dirname $SOURCE_DIR)" != "/usr/local/stow" ]]; then
{'fraction_non_alphanumeric': 0.13900036483035388, 'fraction_numerical': 0.015322874863188618, 'mean_word_length': 4.021978021978022, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '7159001', 'n_tokens_mistral': 1021, 'n_tokens_neox': 955, 'n_words': 336}