<commit_before>COFFEE_DIR = ${PWD}/coffee
JAVASCRIPT_DIR = ${PWD}/js
EXT_DIR = ${PWD}/extensions
BUILD_DIR = ${PWD}/build
DIST_DIR = ${PWD}/dist
TMPL_DIR = ${PWD}/templates
DIST_SRC_DIR = ${DIST_DIR}/src
DIST_MIN_DIR = ${DIST_DIR}/min
PID_FILE = .watch-pid

SASS_DIR = ${PWD}/scss
CSS_DIR = ${PWD}/css
IMG_DIR = ${PWD}/img

COMPILE_SASS = `which sass` --scss --style=compressed \
			   -r ${SASS_DIR}/lib/bourbon/lib/bourbon.rb \
			   ${SASS_DIR}:${CSS_DIR}


COFFEE_JITTER = `which jitter` ${COFFEE_DIR} ${BUILD_DIR}
COMPILE_COFFEE = `which coffee` -b -o ${BUILD_DIR} -c ${COFFEE_DIR}
WATCH_COFFEE = `which coffee` -w -b -o ${BUILD_DIR} -c ${COFFEE_DIR}


BUILD = `which node` bin/r.js -o build.js
OPTIMIZE = `which node` bin/r.js -o optimize.js

all: combine watch

sass:
	@echo 'Compiling Sass...'
	@mkdir -p ${CSS_DIR}
	@${COMPILE_SASS} --update


coffee:
	@echo 'Compiling CoffeeScript...'
	@${COMPILE_COFFEE}

watch: unwatch
	@echo 'Watching...'
	@${COMPILE_SASS} --watch &> /dev/null & echo $$! >> ${PID_FILE}
	@if which jitter &> /dev/null; then \
		 ${COFFEE_JITTER}; else \
	   ${WATCH_COFFEE} &> /dev/null & echo $$! > ${PID_FILE}; \
		 fi;

unwatch:
	@if [ -f ${PID_FILE} ]; then \
		echo 'Watchers stopped'; \
		for pid in `cat ${PID_FILE}`; do kill -9 $$pid; done; \
		rm ${PID_FILE}; \
	fi;

combine: coffee
	@echo 'Combining JavaScript...'
	@cp -r ${JAVASCRIPT_DIR}/* ${BUILD_DIR}
	@ln -sf ${TMPL_DIR} ${BUILD_DIR}
	@echo 'Putting extensions in place...'
	@rm -f ${BUILD_DIR}/ext
	@ln -sf ${EXT_DIR} ${BUILD_DIR}/ext

optimize: combine
	@echo 'Optimizing JavaScript...'
	@rm -rf ${DIST_DIR}
	@mkdir -p ${DIST_DIR}
	@${BUILD} > /dev/null
	@rm -rf ${DIST_SRC_DIR}/templates
	@${OPTIMIZE} > /dev/null
	@rm -rf ${DIST_MIN_DIR}/templates


.PHONY: all sass coffee watch unwatch combine optimize<commit_msg>Ensure the EXT_DIR is created prior to attempting to symlink<commit_after>COFFEE_DIR = ${PWD}/coffee
JAVASCRIPT_DIR = ${PWD}/js
EXT_DIR = ${PWD}/extensions
BUILD_DIR = ${PWD}/build
DIST_DIR = ${PWD}/dist
TMPL_DIR = ${PWD}/templates
DIST_SRC_DIR = ${DIST_DIR}/src
DIST_MIN_DIR = ${DIST_DIR}/min
PID_FILE = .watch-pid

SASS_DIR = ${PWD}/scss
CSS_DIR = ${PWD}/css
IMG_DIR = ${PWD}/img

COMPILE_SASS = `which sass` --scss --style=compressed \
			   -r ${SASS_DIR}/lib/bourbon/lib/bourbon.rb \
			   ${SASS_DIR}:${CSS_DIR}


COFFEE_JITTER = `which jitter` ${COFFEE_DIR} ${BUILD_DIR}
COMPILE_COFFEE = `which coffee` -b -o ${BUILD_DIR} -c ${COFFEE_DIR}
WATCH_COFFEE = `which coffee` -w -b -o ${BUILD_DIR} -c ${COFFEE_DIR}


BUILD = `which node` bin/r.js -o build.js
OPTIMIZE = `which node` bin/r.js -o optimize.js

all: combine watch

sass:
	@echo 'Compiling Sass...'
	@mkdir -p ${CSS_DIR}
	@${COMPILE_SASS} --update


coffee:
	@echo 'Compiling CoffeeScript...'
	@${COMPILE_COFFEE}

watch: unwatch
	@echo 'Watching...'
	@${COMPILE_SASS} --watch &> /dev/null & echo $$! >> ${PID_FILE}
	@if which jitter &> /dev/null; then \
		 ${COFFEE_JITTER}; else \
	   ${WATCH_COFFEE} &> /dev/null & echo $$! > ${PID_FILE}; \
		 fi;

unwatch:
	@if [ -f ${PID_FILE} ]; then \
		echo 'Watchers stopped'; \
		for pid in `cat ${PID_FILE}`; do kill -9 $$pid; done; \
		rm ${PID_FILE}; \
	fi;

combine: coffee
	@echo 'Combining JavaScript...'
	@cp -r ${JAVASCRIPT_DIR}/* ${BUILD_DIR}
	@ln -sf ${TMPL_DIR} ${BUILD_DIR}
	@echo 'Putting extensions in place...'
	@rm -f ${BUILD_DIR}/ext
	@ln -sf ${EXT_DIR} ${BUILD_DIR}/ext

optimize: combine
	@echo 'Optimizing JavaScript...'
	@rm -rf ${DIST_DIR}
	@mkdir -p ${DIST_DIR} ${EXT_DIR}
	@${BUILD} > /dev/null
	@rm -rf ${DIST_SRC_DIR}/templates
	@${OPTIMIZE} > /dev/null
	@rm -rf ${DIST_MIN_DIR}/templates


.PHONY: all sass coffee watch unwatch combine optimize
{'fraction_non_alphanumeric': 0.18706009745533297, 'fraction_numerical': 0.0005414185165132648, 'mean_word_length': 3.7800776196636483, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, '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': '577818', 'n_tokens_mistral': 1628, 'n_tokens_neox': 1551, 'n_words': 367}