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

# check if script was kicked off with root/sudo privileges
if [ "$(whoami)" != "root" ]; then
	echo "Not running as root. Exiting..."
	exit 0
fi

# get OS info
function getosinfo()
{
	export osname=`lsb_release -d | awk '{print $2}'`
	export codename=`lsb_release -c | awk '{print $2}'`
	export release=`lsb_release -r | awk '{print $2}'`
}

base_dir="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

# update PATH just in case
export PATH=$PATH:/sbin:/usr/sbin

# check package manager used on the system and install appropriate packages/init scripts
if [[ `which apt-get` ]]; then
	apt-get update  --fix-missing
	apt-get install -y ruby1.8 ruby1.8-dev rubygems1.8 libopenssl-ruby1.8 build-essential wget curl lsb-release git
	# make sure ruby 1.8 is the default
	update-alternatives --set ruby /usr/bin/ruby1.8
	update-alternatives --set gem /usr/bin/gem1.8
elif [[ `which yum` ]]; then
	# install ruby and git
	yum -y install ruby rubygems ruby-devel
	# make sure gem version and sources are up to date
	[[ ! `gem sources | grep "rubygems.org"` ]] && gem sources -a https://rubygems.org
	gem update --system --no-rdoc --no-ri
else
	echo "Unsuported OS for automatic agent installation. Exiting now..."
	exit 1
fi;

# remove any existing gems
rm ${base_dir}/*.gem
# install the dtk-node-agent gem
gem build ${base_dir}/dtk-node-agent.gemspec
gem install dtk-node-agent*.gem --no-rdoc --no-ri

# remove root ssh files
rm /root/.ssh/id_rsa<commit_msg>Fix gem build issue<commit_after>#!/usr/bin/env bash

# check if script was kicked off with root/sudo privileges
if [ "$(whoami)" != "root" ]; then
	echo "Not running as root. Exiting..."
	exit 0
fi

# get OS info
function getosinfo()
{
	export osname=`lsb_release -d | awk '{print $2}'`
	export codename=`lsb_release -c | awk '{print $2}'`
	export release=`lsb_release -r | awk '{print $2}'`
}

base_dir="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

# update PATH just in case
export PATH=$PATH:/sbin:/usr/sbin

# check package manager used on the system and install appropriate packages/init scripts
if [[ `which apt-get` ]]; then
	apt-get update  --fix-missing
	apt-get install -y ruby1.8 ruby1.8-dev rubygems1.8 libopenssl-ruby1.8 build-essential wget curl lsb-release git
	# make sure ruby 1.8 is the default
	update-alternatives --set ruby /usr/bin/ruby1.8
	update-alternatives --set gem /usr/bin/gem1.8
elif [[ `which yum` ]]; then
	# install ruby and git
	yum -y install ruby rubygems ruby-devel
	# make sure gem version and sources are up to date
	[[ ! `gem sources | grep "rubygems.org"` ]] && gem sources -a https://rubygems.org
	gem update --system --no-rdoc --no-ri
else
	echo "Unsuported OS for automatic agent installation. Exiting now..."
	exit 1
fi;

# remove any existing gems
rm ${base_dir}/*.gem
# install the dtk-node-agent gem
cd ${base_dir}
gem build ${base_dir}/dtk-node-agent.gemspec
gem install ${base_dir}/dtk-node-agent*.gem --no-rdoc --no-ri

# remove root ssh files
rm /root/.ssh/id_rsa
{'fraction_non_alphanumeric': 0.1401126200728718, 'fraction_numerical': 0.013249420337860219, 'mean_word_length': 3.653312788906009, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '1598778', 'n_tokens_mistral': 1112, 'n_tokens_neox': 1039, 'n_words': 364}