<commit_before>#!/bin/sh

lessc_cmd="lessc"
lessc_opt="--yui-compress"
lessc_src="skin/main.less"
lessc_tgt="skin/skin.css"

js_src_files="src/polyfill.js src/server.js src/stars.js src/app.js"
js_tgt="konopas.min.js"

precache_files="$js_tgt $lessc_tgt skin/*.ttf"


do_lessc=true
do_js_min=true
do_precache=false

usage="usage: $0 [options]
  -c  DON'T use lessc to compile CSS
  -j  DON'T minify JavaScript
  -p  DO generate precache files: $precache_files"

while getopts "hcjp" OPT; do case $OPT in
	c) do_lessc=false;;
	j) do_js_min=false;;
	p) do_precache=true;;
	h) echo "$usage"; exit 0;;
	*) echo "$usage"; exit 1;;
esac; done

if $do_lessc; then
	echo -n "Compiling $lessc_src to $lessc_tgt... "
	$lessc_cmd $lessc_opt "$lessc_src" "$lessc_tgt"
	if [ $? -ne 0 ]; then echo "lessc error!"; exit 1; fi
	echo "done."
fi

if $do_js_min; then
	echo -n "Minifying JS from src/ to $js_tgt... "
	tmp=$(tempfile -p 'ko-')
	if [ $? -ne 0 ]; then echo "tempfile error!"; exit 1; fi
	cat $js_src_files > "$tmp"
	if [ $? -ne 0 ]; then echo "cat error!"; exit 1; fi
	curl -X POST -s --data-urlencode "input@$tmp" http://javascript-minifier.com/raw > "$js_tgt"
	if [ $? -ne 0 ]; then echo "cURL error!"; rm "$tmp"; exit 1; fi
	rm "$tmp"
	echo "done."
fi

if $do_precache; then
	echo -n "Pre-caching files: "
	for f in $precache_files; do
		echo -n "$f... "
		gzip -c "$f" > "$f.gz"
		if [ $? -ne 0 ]; then echo "gzip error!"; exit 1; fi
	done
	echo "done."
fi

echo "All done."
exit 0
<commit_msg>build script defaults to doing nothing<commit_after>#!/bin/sh

lessc_cmd="lessc"
lessc_opt="--yui-compress"
lessc_src="skin/main.less"
lessc_tgt="skin/skin.css"

js_src_files="src/polyfill.js src/server.js src/stars.js src/app.js"
js_tgt="konopas.min.js"

precache_files="$js_tgt $lessc_tgt skin/*.ttf"


do_lessc=false
do_js_min=false
do_precache=false

usage="usage: $0 [options]
  -c  use lessc to compile $lessc_src to $lessc_tgt
  -j  minify JavaScript from src/ to $js_tgt
  -p  generate precache files: $precache_files
  -h  display this helpful text and exit"

while getopts "hcjp" OPT; do case $OPT in
	c) do_lessc=true;;
	j) do_js_min=true;;
	p) do_precache=true;;
	h) echo "$usage"; exit 0;;
	*) echo "$usage"; exit 1;;
esac; done

done=false

if $do_lessc; then
	echo -n "Compiling $lessc_src to $lessc_tgt... "
	$lessc_cmd $lessc_opt "$lessc_src" "$lessc_tgt"
	if [ $? -ne 0 ]; then echo "lessc error!"; exit 1; fi
	echo "ok."; done=true
fi

if $do_js_min; then
	echo -n "Minifying JS from src/ to $js_tgt... "
	tmp=$(tempfile -p 'ko-')
	if [ $? -ne 0 ]; then echo "tempfile error!"; exit 1; fi
	cat $js_src_files > "$tmp"
	if [ $? -ne 0 ]; then echo "cat error!"; exit 1; fi
	curl -X POST -s --data-urlencode "input@$tmp" http://javascript-minifier.com/raw > "$js_tgt"
	if [ $? -ne 0 ]; then echo "cURL error!"; rm "$tmp"; exit 1; fi
	rm "$tmp"
	echo "ok."; done=true
fi

if $do_precache; then
	echo "Pre-caching files:"
	for f in $precache_files; do
		echo "  $f..."
		gzip -c "$f" > "$f.gz"
		if [ $? -ne 0 ]; then echo "gzip error!"; exit 1; fi
	done
	echo "  ok."; done=true
fi

if $done; then echo "All done."
else echo "$usage"; fi

exit 0

{'fraction_non_alphanumeric': 0.16809387884554391, 'fraction_numerical': 0.008880431335236283, 'mean_word_length': 3.693452380952381, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '5051155', 'n_tokens_mistral': 1388, 'n_tokens_neox': 1341, 'n_words': 398}