<commit_before>#!/usr/bin/env

reset_development_server() {

	local devServiceFileName="dev-instacrated.service.txt"
	local devServiceName="dev-instacrated.service"
	local destinationPath="/etc/systemd/system/"

	echo "\n>>>> sudo cp $devServiceFileName $destinationPath$devServiceName"
	sudo cp "$devServiceFileName" "$destinationPath$devServiceName"

	echo "\n>>>> sudo chmod 664 $destinationPath$devServiceName"
	sudo chmod 664 "$destinationPath$devServiceName"

	echo "\n>>>> systemctl daemon-reload"
	systemctl daemon-reload

	echo "\n>>>> systemctl restart $devServiceName"
	systemctl restart "$devServiceName"
}

reset_production_server() {

	local prodServiceFileName="instacrated.service.txt"
	local prodServiceName="instacrated.service"
	local destinationPath="/etc/systemd/system/"

	echo "\n>>>> sudo cp $prodServiceFileName $destinationPath$prodServiceName"
	sudo cp "$prodServiceFileName" "$destinationPath$prodServiceName"

	echo "\n>>>> sudo chmod 664 $destinationPath$prodServiceName"
	sudo chmod 664 "$destinationPath$devServiceName"

	echo "\n>>>> systemctl daemon-reload"
	systemctl daemon-reload

	echo "\n>>>> systemctl restart $prodServiceName"
	systemctl restart "$prodServiceName"
}

echo "\n>>>> git pull origin master"
git pull origin master

if [[ $(git diff --name-only HEAD~1 HEAD 'update.sh') ]]; then
	# re-run the update script because it was just updated in the git pull
	exec 'sh update.sh'
	exit 0
fi

if [[ $(git diff --name-only HEAD~	1 HEAD nginx/) ]]; then
	echo "\n>>>> sudo cp -ru nginx/* /etc/nginx/"
	sudo cp -ru nginx/* /etc/nginx/
fi

echo "\n>>>> vapor build --release=true --fetch=false"
vapor build --release=true --fetch=false

echo "\n>>>> sudo systemctl restart instacrated.service"
sudo systemctl restart instacrated.service

echo "\n>>>> sudo systemctl restart dev-instacrated.service"
sudo systemctl restart dev-instacrated.service

if [[ $(git diff --name-only instacrated.service.txt) ]]; then
    echo "\n>>>> Detected changes in production server configuration files!"
	reset_production_server
fi

if [[ $(git diff --name-only dev-instacrated.service.txt) ]]; then
	echo "\n>>>> Detected changes in development server configuration files!"
	reset_development_server
fi<commit_msg>testing<commit_after>#!/usr/bin/env

reset_development_server() {

	local devServiceFileName="dev-instacrated.service.txt"
	local devServiceName="dev-instacrated.service"
	local destinationPath="/etc/systemd/system/"

	echo "\n>>>> sudo cp $devServiceFileName $destinationPath$devServiceName"
	sudo cp "$devServiceFileName" "$destinationPath$devServiceName"

	echo "\n>>>> sudo chmod 664 $destinationPath$devServiceName"
	sudo chmod 664 "$destinationPath$devServiceName"

	echo "\n>>>> systemctl daemon-reload"
	systemctl daemon-reload

	echo "\n>>>> systemctl restart $devServiceName"
	systemctl restart "$devServiceName"
}

reset_production_server() {

	local prodServiceFileName="instacrated.service.txt"
	local prodServiceName="instacrated.service"
	local destinationPath="/etc/systemd/system/"

	echo "\n>>>> sudo cp $prodServiceFileName $destinationPath$prodServiceName"
	sudo cp "$prodServiceFileName" "$destinationPath$prodServiceName"

	echo "\n>>>> sudo chmod 664 $destinationPath$prodServiceName"
	sudo chmod 664 "$destinationPath$devServiceName"

	echo "\n>>>> systemctl daemon-reload"
	systemctl daemon-reload

	echo "\n>>>> systemctl restart $prodServiceName"
	systemctl restart "$prodServiceName"
}

echo "\n>>>> git pull origin master"
git pull origin master

if [[ $(git diff --name-only HEAD~1 HEAD -- update.sh) ]]; then
	# re-run the update script because it was just updated in the git pull
	exec 'sh update.sh'
	exit 0
fi

if [[ $(git diff --name-only HEAD~ HEAD -- nginx/) ]]; then
	echo "\n>>>> sudo cp -ru nginx/* /etc/nginx/"
	sudo cp -ru nginx/* /etc/nginx/
fi

echo "\n>>>> vapor build --release=true --fetch=false"
vapor build --release=true --fetch=false

echo "\n>>>> sudo systemctl restart instacrated.service"
sudo systemctl restart instacrated.service

echo "\n>>>> sudo systemctl restart dev-instacrated.service"
sudo systemctl restart dev-instacrated.service

if [[ $(git diff --name-only HEAD~1 HEAD -- instacrated.service.txt) ]]; then
    echo "\n>>>> Detected changes in production server configuration files!"
	reset_production_server
fi

if [[ $(git diff --name-only HEAD~1 HEAD -- dev-instacrated.service.txt) ]]; then
	echo "\n>>>> Detected changes in development server configuration files!"
	reset_development_server
fi
{'fraction_non_alphanumeric': 0.13099467140319715, 'fraction_numerical': 0.006882770870337478, 'mean_word_length': 5.205234159779614, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 123, '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': '849464', 'n_tokens_mistral': 1460, 'n_tokens_neox': 1337, 'n_words': 414}