<commit_before>build: clean
	gem install bundler
	bundle install
	bundle exec middleman build --no-parallel
.PHONY: build

clean:
	rm -rf build

run: build
	BUILDER_WEB_URL="http://localhost:3000" GITHUB_APP_URL="https://github.com/apps/habitat-builder" bundle exec middleman serve

sync: build check-env
	bundle exec middleman s3_sync
.PHONY: sync

purge_cache: check-env
	curl -H "Fastly-Key: ${FASTLY_API_KEY}" -X POST "https://api.fastly.com/service/${FASTLY_SERVICE_KEY}/purge_all"

prep:
	sed -i'' '/^Disallow:/ s/$$/ \//' build/robots.txt
	zip -r website.zip build

deploy: build sync purge_cache

acceptance: build prep
	curl -H "Content-Type: application/zip" \
    -H "Authorization: Bearer $(NETLIFYKEY)" \
    --data-binary "@website.zip" \
    --url "https://api.netlify.com/api/v1/sites/habitat-acceptance.netlify.com/deploys"

cli_docs:
	hab studio run "hab pkg install core/hab-studio && \
	hab pkg install core/hab-sup && \
	hab pkg install core/hab-launcher && \
	hab pkg install core/node --binlink /bin && \
	/bin/node scripts/generate-cli-docs > source/docs/habitat-cli.html.md"

node_modules/json-schema-ref-parser:
	npm install json-schema-ref-parser@6.1.0

template_reference: node_modules/json-schema-ref-parser
	mkdir tmp
	cp ../components/sup/doc/* tmp/
	hab studio run "hab pkg install core/node --binlink /bin && \
	/bin/node scripts/generate-template-reference.js tmp/render_context_schema.json > ./source/partials/docs/_reference-template-data.html.md.erb"
	rm -rf tmp

check-env:
ifndef AWS_BUCKET
	$(error AWS_BUCKET is undefined)
endif
ifndef AWS_DEFAULT_REGION
	$(error AWS_DEFAULT_REGION is undefined)
endif
ifndef FASTLY_API_KEY
	$(error FASTLY_API_KEY is undefined)
endif
ifndef FASTLY_SERVICE_KEY
	$(error FASTLY_SERVICE_KEY is undefined)
endif
<commit_msg>Update Makefile to correct errors with binlink<commit_after>build: clean
	gem install bundler
	bundle install
	bundle exec middleman build --no-parallel
.PHONY: build

clean:
	rm -rf build

run: build
	BUILDER_WEB_URL="http://localhost:3000" GITHUB_APP_URL="https://github.com/apps/habitat-builder" bundle exec middleman serve

sync: build check-env
	bundle exec middleman s3_sync
.PHONY: sync

purge_cache: check-env
	curl -H "Fastly-Key: ${FASTLY_API_KEY}" -X POST "https://api.fastly.com/service/${FASTLY_SERVICE_KEY}/purge_all"

prep:
	sed -i'' '/^Disallow:/ s/$$/ \//' build/robots.txt
	zip -r website.zip build

deploy: build sync purge_cache

acceptance: build prep
	curl -H "Content-Type: application/zip" \
    -H "Authorization: Bearer $(NETLIFYKEY)" \
    --data-binary "@website.zip" \
    --url "https://api.netlify.com/api/v1/sites/habitat-acceptance.netlify.com/deploys"

cli_docs:
	hab studio run "hab pkg install core/hab-studio && \
	hab pkg install core/hab-sup && \
	hab pkg install core/hab-launcher && \
	hab pkg install core/node && \
	hab pkg binlink core/node --dest=/bin && \
	/bin/node scripts/generate-cli-docs > source/docs/habitat-cli.html.md"

template_reference:
	mkdir tmp
	cp ../components/sup/doc/* tmp/
	hab studio run "hab pkg install core/node && \
	hab pkg binlink core/node --dest=/bin && \
	npm install json-schema-ref-parser@6.1.0 && \
	/bin/node scripts/generate-template-reference.js tmp/render_context_schema.json > ./source/partials/docs/_reference-template-data.html.md.erb"
	rm -rf tmp

check-env:
ifndef AWS_BUCKET
	$(error AWS_BUCKET is undefined)
endif
ifndef AWS_DEFAULT_REGION
	$(error AWS_DEFAULT_REGION is undefined)
endif
ifndef FASTLY_API_KEY
	$(error FASTLY_API_KEY is undefined)
endif
ifndef FASTLY_SERVICE_KEY
	$(error FASTLY_SERVICE_KEY is undefined)
endif

{'fraction_non_alphanumeric': 0.12451577199778639, 'fraction_numerical': 0.004980630879911455, 'mean_word_length': 4.055944055944056, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 6, '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': '1620537', 'n_tokens_mistral': 1322, 'n_tokens_neox': 1295, 'n_words': 318}