<commit_before>VERSION=$(shell cat green/VERSION)

clean: clean-message clean-silent

clean-message:
	@echo "Cleaning generated files and directories."

clean-silent:
	@find . -name '*.pyc' -exec rm \{\} \;
	@find . -name '.coverage*' -exec rm \{\} \;
	@rm -rf _trial_temp build dist green.egg-info green-*

test: test-versions test-installed test-coverage
	# test-coverage needs to be last in deps, don't clean after it runs!
	@echo "\n(test) completed\n"

test-local:
	@sudo -H pip install -r requirements-optional.txt
	-@sudo -H pip uninstall green
	@sudo -H make test-installed
	make test-versions
	make test-coverage
	@# test-coverage needs to be last in deps, don't clean after it runs!

test-coverage:
	# Coverage of green should not include coverage of the example project
	@make clean-silent
	! ./g -r green | grep example/
	@make clean-silent
	# Generate coverage files for travis builds (don't clean after this!)
	./g -s 0 -r -vvv green
	@echo "\n(test-coverage) completed\n"

test-installed:
	# Install under the default python and run self-tests
	@make clean-silent
	python setup.py sdist
	tar zxvf dist/green-$(VERSION).tar.gz
	bash -c "cd green-$(VERSION) && python setup.py install"
	bash -c "cd && green -vvv green"
	bash -c "cd && green -s 0 -vvv green"
	pip uninstall -y green
	@make clean-silent
	@echo "\n(test-installed) completed\n"

test-versions:
	# Run the in-place stub under all python versions in the path
	@make clean-silent
	./test_versions
	@make clean-silent
	@echo "\n(test-versions) completed\n"

sanity-checks:
	@if ! ./g -r green | grep TOTAL | grep "0   100%" ; then echo 'Coverage needs to be at 100% for a release!' && exit 1; fi
	@if git show-ref --verify --quiet refs/tags/$(VERSION) ; then printf "\nVersion $(VERSION) has already been tagged.\nIf the make process died after tagging, but before actually releasing, you can try 'make release-unsafe'\n\n" ; exit 1 ; fi
	@if [[ $(shell git rev-parse --abbrev-ref HEAD) != "master" ]] ; then echo "\nYou need to be on the master branch to release.\n" && exit 1 ; fi
	@./g -h > cli-options.txt
	@printf "\n== SANITY CHECK: GIT STATUS ==\n"
	@git status
	@printf "\nIs everything committed?  (Ctrl-C if not!) "
	@read

release-test: test-local sanity-checks<commit_msg>Better install all the optional dependencies for the 'installed test' too.<commit_after>VERSION=$(shell cat green/VERSION)

clean: clean-message clean-silent

clean-message:
	@echo "Cleaning generated files and directories."

clean-silent:
	@find . -name '*.pyc' -exec rm \{\} \;
	@find . -name '.coverage*' -exec rm \{\} \;
	@rm -rf _trial_temp build dist green.egg-info green-*

test: test-versions test-installed test-coverage
	# test-coverage needs to be last in deps, don't clean after it runs!
	@echo "\n(test) completed\n"

test-local:
	@sudo -H pip install -r requirements-optional.txt
	-@sudo -H pip uninstall green
	@sudo -H make test-installed
	make test-versions
	make test-coverage
	@# test-coverage needs to be last in deps, don't clean after it runs!

test-coverage:
	# Coverage of green should not include coverage of the example project
	@make clean-silent
	! ./g -r green | grep example/
	@make clean-silent
	# Generate coverage files for travis builds (don't clean after this!)
	./g -s 0 -r -vvv green
	@echo "\n(test-coverage) completed\n"

test-installed:
	# Install under the default python and run self-tests
	@make clean-silent
	pip install -r requirements-optional.txt
	python setup.py sdist
	tar zxvf dist/green-$(VERSION).tar.gz
	bash -c "cd green-$(VERSION) && python setup.py install"
	bash -c "cd && green -vvv green"
	bash -c "cd && green -s 0 -vvv green"
	pip uninstall -y green
	@make clean-silent
	@echo "\n(test-installed) completed\n"

test-versions:
	# Run the in-place stub under all python versions in the path
	@make clean-silent
	./test_versions
	@make clean-silent
	@echo "\n(test-versions) completed\n"

sanity-checks:
	@if ! ./g -r green | grep TOTAL | grep "0   100%" ; then echo 'Coverage needs to be at 100% for a release!' && exit 1; fi
	@if git show-ref --verify --quiet refs/tags/$(VERSION) ; then printf "\nVersion $(VERSION) has already been tagged.\nIf the make process died after tagging, but before actually releasing, you can try 'make release-unsafe'\n\n" ; exit 1 ; fi
	@if [[ $(shell git rev-parse --abbrev-ref HEAD) != "master" ]] ; then echo "\nYou need to be on the master branch to release.\n" && exit 1 ; fi
	@./g -h > cli-options.txt
	@printf "\n== SANITY CHECK: GIT STATUS ==\n"
	@git status
	@printf "\nIs everything committed?  (Ctrl-C if not!) "
	@read

release-test: test-local sanity-checks
{'fraction_non_alphanumeric': 0.1281662697553583, 'fraction_numerical': 0.005195929854946958, 'mean_word_length': 3.5294117647058822, 'pattern_counts': {'":': 0, '<': 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': '577435', 'n_tokens_mistral': 1631, 'n_tokens_neox': 1535, 'n_words': 593}