<commit_before>#!/bin/bash
set -e

echo ":: mainframer v2.0.0-dev"
echo ""

BUILD_START_TIME=`date +%s`

PROJECT_DIR="`pwd`"
PROJECT_DIR_NAME="$( basename "$PROJECT_DIR")"
MAINFRAMER_DIR="$PROJECT_DIR/.mainframer"
PERSONAL_CONFIG_FILE="$MAINFRAMER_DIR/personalconfig"
LOCAL_IGNORE_FILE="$MAINFRAMER_DIR/localignore"
REMOTE_IGNORE_FILE="$MAINFRAMER_DIR/remoteignore"
COMMON_IGNORE_FILE="$MAINFRAMER_DIR/commonignore"

function property {
    grep "^${1}=" "$PERSONAL_CONFIG_FILE" | cut -d'=' -f2
}

# Config properties.
REMOTE_MACHINE_PROPERTY="remote_machine"
LOCAL_COMPRESS_LEVEL_PROPERTY="local_compression_level"
REMOTE_COMPRESS_LEVEL_PROPERTY="remote_compression_level"

# Read config properties.
REMOTE_BUILD_MACHINE=$(property "$REMOTE_MACHINE_PROPERTY")
LOCAL_COMPRESS_LEVEL=$(property "$LOCAL_COMPRESS_LEVEL_PROPERTY")
REMOTE_COMPRESS_LEVEL=$(property "$REMOTE_COMPRESS_LEVEL_PROPERTY")

if [ -z "$LOCAL_COMPRESS_LEVEL" ]; then
	LOCAL_COMPRESS_LEVEL=1
fi

if [ -z "$REMOTE_COMPRESS_LEVEL" ]; then
	REMOTE_COMPRESS_LEVEL=1
fi

if [ -z "$REMOTE_BUILD_MACHINE" ]; then
	echo "Please specify \"$REMOTE_MACHINE_PROPERTY\" in $PERSONAL_CONFIG_FILE"
	exit 1
fi

BUILD_COMMAND="$@"

if [ -z "$BUILD_COMMAND" ]; then
	echo "Please pass build command."
	exit 1
fi

function syncBeforeBuild {
	echo "Sync local → remote machine..."
	startTime=`date +%s`

	COMMAND="rsync --archive --delete --relative= --compress-level=$LOCAL_COMPRESS_LEVEL "

	if [ -f "$LOCAL_IGNORE_FILE" ]; then
		COMMAND+="--exclude-from='$LOCAL_IGNORE_FILE' "
	fi

	if [ -f "$COMMON_IGNORE_FILE" ]; then
		COMMAND+="--exclude-from='$COMMON_IGNORE_FILE' "
	fi

	COMMAND+="--rsh ssh ./ $REMOTE_BUILD_MACHINE:~/$PROJECT_DIR_NAME"

	eval "$COMMAND"

	endTime=`date +%s`
	echo "Sync done: took `expr $endTime - $startTime` seconds."
	echo ""
}

function buildProjectOnRemoteMachine {
	echo "Executing build on remote machine…"
	startTime=`date +%s`

	ssh $REMOTE_BUILD_MACHINE "echo 'set -xe && cd ~/$PROJECT_DIR_NAME/ && $BUILD_COMMAND' | bash"

	endTime=`date +%s`
	echo "Execution done: took `expr $endTime - $startTime` seconds."
	echo ""
}

function syncAfterBuild {
	echo "Sync remote → local machine…"
	startTime=`date +%s`

	COMMAND="rsync --archive --delete --compress-level=$REMOTE_COMPRESS_LEVEL "

	if [ -f "$REMOTE_IGNORE_FILE" ]; then
		COMMAND+="--exclude-from='$REMOTE_IGNORE_FILE' "
	fi

	if [ -f "$COMMON_IGNORE_FILE" ]; then
		COMMAND+="--exclude-from='$COMMON_IGNORE_FILE' "
	fi

	COMMAND+="--rsh ssh $REMOTE_BUILD_MACHINE:~/$PROJECT_DIR_NAME/ ./"
	eval "$COMMAND"

	endTime=`date +%s`
	echo "Sync done: took `expr $endTime - $startTime` seconds."
}

pushd "$PROJECT_DIR" > /dev/null
<commit_msg>Change remote execution formatting to be less verbose. (#89)<commit_after>#!/bin/bash
set -e

echo ":: mainframer v2.0.0-dev"
echo ""

BUILD_START_TIME=`date +%s`

PROJECT_DIR="`pwd`"
PROJECT_DIR_NAME="$( basename "$PROJECT_DIR")"
MAINFRAMER_DIR="$PROJECT_DIR/.mainframer"
PERSONAL_CONFIG_FILE="$MAINFRAMER_DIR/personalconfig"
LOCAL_IGNORE_FILE="$MAINFRAMER_DIR/localignore"
REMOTE_IGNORE_FILE="$MAINFRAMER_DIR/remoteignore"
COMMON_IGNORE_FILE="$MAINFRAMER_DIR/commonignore"

function property {
    grep "^${1}=" "$PERSONAL_CONFIG_FILE" | cut -d'=' -f2
}

# Config properties.
REMOTE_MACHINE_PROPERTY="remote_machine"
LOCAL_COMPRESS_LEVEL_PROPERTY="local_compression_level"
REMOTE_COMPRESS_LEVEL_PROPERTY="remote_compression_level"

# Read config properties.
REMOTE_BUILD_MACHINE=$(property "$REMOTE_MACHINE_PROPERTY")
LOCAL_COMPRESS_LEVEL=$(property "$LOCAL_COMPRESS_LEVEL_PROPERTY")
REMOTE_COMPRESS_LEVEL=$(property "$REMOTE_COMPRESS_LEVEL_PROPERTY")

if [ -z "$LOCAL_COMPRESS_LEVEL" ]; then
	LOCAL_COMPRESS_LEVEL=1
fi

if [ -z "$REMOTE_COMPRESS_LEVEL" ]; then
	REMOTE_COMPRESS_LEVEL=1
fi

if [ -z "$REMOTE_BUILD_MACHINE" ]; then
	echo "Please specify \"$REMOTE_MACHINE_PROPERTY\" in $PERSONAL_CONFIG_FILE"
	exit 1
fi

BUILD_COMMAND="$@"

if [ -z "$BUILD_COMMAND" ]; then
	echo "Please pass build command."
	exit 1
fi

function syncBeforeBuild {
	echo "Sync local → remote machine..."
	startTime=`date +%s`

	COMMAND="rsync --archive --delete --relative= --compress-level=$LOCAL_COMPRESS_LEVEL "

	if [ -f "$LOCAL_IGNORE_FILE" ]; then
		COMMAND+="--exclude-from='$LOCAL_IGNORE_FILE' "
	fi

	if [ -f "$COMMON_IGNORE_FILE" ]; then
		COMMAND+="--exclude-from='$COMMON_IGNORE_FILE' "
	fi

	COMMAND+="--rsh ssh ./ $REMOTE_BUILD_MACHINE:~/$PROJECT_DIR_NAME"

	eval "$COMMAND"

	endTime=`date +%s`
	echo "Sync done: took `expr $endTime - $startTime` seconds."
	echo ""
}

function buildProjectOnRemoteMachine {
	echo "Executing build on remote machine…"
	echo ""
	startTime=`date +%s`

	ssh $REMOTE_BUILD_MACHINE "echo 'set -e && cd ~/$PROJECT_DIR_NAME/ && $BUILD_COMMAND' | bash"

	endTime=`date +%s`
	echo ""
	echo "Execution done: took `expr $endTime - $startTime` seconds."
	echo ""
}

function syncAfterBuild {
	echo "Sync remote → local machine…"
	startTime=`date +%s`

	COMMAND="rsync --archive --delete --compress-level=$REMOTE_COMPRESS_LEVEL "

	if [ -f "$REMOTE_IGNORE_FILE" ]; then
		COMMAND+="--exclude-from='$REMOTE_IGNORE_FILE' "
	fi

	if [ -f "$COMMON_IGNORE_FILE" ]; then
		COMMAND+="--exclude-from='$COMMON_IGNORE_FILE' "
	fi

	COMMAND+="--rsh ssh $REMOTE_BUILD_MACHINE:~/$PROJECT_DIR_NAME/ ./"
	eval "$COMMAND"

	endTime=`date +%s`
	echo "Sync done: took `expr $endTime - $startTime` seconds."
}

pushd "$PROJECT_DIR" > /dev/null

{'fraction_non_alphanumeric': 0.1467551622418879, 'fraction_numerical': 0.003687315634218289, 'mean_word_length': 5.714108910891089, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 5, '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': '3570027', 'n_tokens_mistral': 2180, 'n_tokens_neox': 2044, 'n_words': 400}