<commit_before>#!/bin/bash
WGET_OPTS="-nv"
RAILO_URL="http://getrailo.com/railo/remote/download/4.1.1.009/railix/linux/railo-express-4.1.1.009-nojre.tar.gz"
MXUNIT_URL="https://github.com/marcins/mxunit/archive/fix-railo-nulls.zip"

# WORK_DIR and BUILD_DIR must be set!
if [ ! -n "$WORK_DIR" ]; then
	echo "WORK_DIR must be set!"
	exit 1
fi

if [ ! -n "$BUILD_DIR" ]; then
	BUILD_DIR=`pwd`
fi

echo "Working directory: $WORK_DIR, Build directory: $BUILD_DIR"

if [ ! "$1" == "install" ]; then
	if [ ! -d $WORKDIR ]; then
		echo "Working directory doesn't exist and this isn't an install!"
		exit 1
	else
		cd $WORKDIR
	fi
fi

case $1 in
	install)
		if [ -d $WORKDIR ]; then
			#rm -rf $WORKDIR
		fi

		mkdir -p $WORKDIR
		cd $WORKDIR

		# Download Railo Express
		if [[ "$RAILO_URL" == *zip ]]; then
			wget $WGET_OPTS $RAILO_URL -O railo.zip
			unzip -q railo.zip
		else
			wget $WGET_OPTS $RAILO_URL -O railo.tar.gz
			tar -zxf railo.tar.gz
		fi
		mv railo-express* railo
		wget $WGET_OPTS $MXUNIT_URL -O mxunit.zip
		unzip -q mxunit.zip -d railo/webapps/www/
		mv railo/webapps/www/mxunit* railo/webapps/www/mxunit
		ln -s $TRAVIS_BUILD_DIR railo/webapps/www/$2
		;;
	start)
		if [ ! -f railo/start ]; then
			echo "Railo start script does not exist!"
			exit 1
		fi
		echo "Starting Railo..."
		sh railo/start>/dev/null &
		until curl -s http://localhost:8888>/dev/null
		do
			echo "Waiting for Railo..."
			sleep 1
		done
		;;
	stop)
		echo "Stopping Railo..."
		sh railo/stop
		while curl -s http://localhost:8888>/dev/null
		do
			echo "Waiting for Railo..."
			sleep 1
		done
		;;
	*)
		echo "Usage: $0 {install|start|stop}"
		exit 1
		;;
esac

exit 0<commit_msg>Make sure script doesn't fail for now with no WORK_DIR<commit_after>#!/bin/bash
WGET_OPTS="-nv"
RAILO_URL="http://getrailo.com/railo/remote/download/4.1.1.009/railix/linux/railo-express-4.1.1.009-nojre.tar.gz"
MXUNIT_URL="https://github.com/marcins/mxunit/archive/fix-railo-nulls.zip"

# WORK_DIR and BUILD_DIR must be set!
if [ ! -n "$WORK_DIR" ]; then
	echo "WORK_DIR must be set!"
	exit 1
fi

if [ ! -n "$BUILD_DIR" ]; then
	BUILD_DIR=`pwd`
fi

echo "Working directory: $WORK_DIR, Build directory: $BUILD_DIR"

if [ ! "$1" == "install" ]; then
	if [ ! -d $WORKDIR ]; then
		echo "Working directory doesn't exist and this isn't an install!"
		exit 1
	else
		cd $WORKDIR
	fi
fi

case $1 in
	install)
		if [ -d $WORKDIR ]; then
			echo "DEBUG not removing $WORKDIR"
			#rm -rf $WORKDIR
		fi

		mkdir -p $WORKDIR
		cd $WORKDIR

		# Download Railo Express
		if [[ "$RAILO_URL" == *zip ]]; then
			wget $WGET_OPTS $RAILO_URL -O railo.zip
			unzip -q railo.zip
		else
			wget $WGET_OPTS $RAILO_URL -O railo.tar.gz
			tar -zxf railo.tar.gz
		fi
		mv railo-express* railo
		wget $WGET_OPTS $MXUNIT_URL -O mxunit.zip
		unzip -q mxunit.zip -d railo/webapps/www/
		mv railo/webapps/www/mxunit* railo/webapps/www/mxunit
		ln -s $TRAVIS_BUILD_DIR railo/webapps/www/$2
		;;
	start)
		if [ ! -f railo/start ]; then
			echo "Railo start script does not exist!"
			exit 1
		fi
		echo "Starting Railo..."
		sh railo/start>/dev/null &
		until curl -s http://localhost:8888>/dev/null
		do
			echo "Waiting for Railo..."
			sleep 1
		done
		;;
	stop)
		echo "Stopping Railo..."
		sh railo/stop
		while curl -s http://localhost:8888>/dev/null
		do
			echo "Waiting for Railo..."
			sleep 1
		done
		;;
	*)
		echo "Usage: $0 {install|start|stop}"
		exit 1
		;;
esac

exit 0
{'fraction_non_alphanumeric': 0.14072992700729928, 'fraction_numerical': 0.018102189781021898, 'mean_word_length': 2.947004608294931, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 2, 'lorem ipsum': 0, 'www.': 8, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4642697', 'n_tokens_mistral': 1578, 'n_tokens_neox': 1407, 'n_words': 375}