<commit_before>.DEFAULT_GOAL := build

GOPATH := $(shell go env | grep GOPATH | sed 's/GOPATH="\(.*\)"/\1/')
PATH := $(GOPATH)/bin:$(PATH)
export $(PATH)

BINARY=geoip
LD_FLAGS += -s -w

help:
	@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

release: clean fetch ## Generate a release, but don't publish to GitHub.
	$(GOPATH)/bin/goreleaser --skip-validate --skip-publish

publish: clean fetch ## Generate a release, and publish to GitHub.
	$(GOPATH)/bin/goreleaser

snapshot: clean fetch ## Generate a snapshot release.
	$(GOPATH)/bin/goreleaser --snapshot --skip-validate --skip-publish

update-deps: fetch ## Updates all dependencies to the latest available versions.
	$(GOPATH)/bin/govendor add +external
	$(GOPATH)/bin/govendor remove +unused
	$(GOPATH)/bin/govendor update +external

fetch: ## Fetches the necessary dependencies to build.
	test -f $(GOPATH)/bin/govendor || go get -u -v github.com/kardianos/govendor
	test -f $(GOPATH)/bin/goreleaser || go get -u -v github.com/goreleaser/goreleaser
	$(GOPATH)/bin/govendor sync

clean: ## Cleans up generated files/folders from the build.
	/bin/rm -rfv "dist/" "static/" "${BINARY}"

generate-dev:
	cd public && npm run dev
	mkdir -vp "static"
	cp -av public/index.html static/
	cp -av public/dist static/

generate:
	cd public && npm run build
	mkdir -vp "static"
	cp -av public/index.html static/
	cp -av public/dist static/
	$(GOPATH)/bin/rice -v embed-go

debug: fetch clean generate-dev ## Runs the application in debug mode.
	go run *.go -d --http.limit 2000 --update-url "http://hq.liam.sh/tmp/GeoLite2-City.mmdb.gz"

build: fetch clean generate ## Builds the application.
	go build -ldflags "${LD_FLAGS}" -i -v -o ${BINARY}
<commit_msg>add rice to dev fetch task<commit_after>.DEFAULT_GOAL := build

GOPATH := $(shell go env | grep GOPATH | sed 's/GOPATH="\(.*\)"/\1/')
PATH := $(GOPATH)/bin:$(PATH)
export $(PATH)

BINARY=geoip
LD_FLAGS += -s -w

help:
	@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

release: clean fetch ## Generate a release, but don't publish to GitHub.
	$(GOPATH)/bin/goreleaser --skip-validate --skip-publish

publish: clean fetch ## Generate a release, and publish to GitHub.
	$(GOPATH)/bin/goreleaser

snapshot: clean fetch ## Generate a snapshot release.
	$(GOPATH)/bin/goreleaser --snapshot --skip-validate --skip-publish

update-deps: fetch ## Updates all dependencies to the latest available versions.
	$(GOPATH)/bin/govendor add +external
	$(GOPATH)/bin/govendor remove +unused
	$(GOPATH)/bin/govendor update +external

fetch: ## Fetches the necessary dependencies to build.
	test -f $(GOPATH)/bin/govendor || go get -u -v github.com/kardianos/govendor
	test -f $(GOPATH)/bin/goreleaser || go get -u -v github.com/goreleaser/goreleaser
	test -f $(GOPATH)/bin/rice || go get -u -v github.com/GeertJohan/go.rice/rice
	$(GOPATH)/bin/govendor sync

clean: ## Cleans up generated files/folders from the build.
	/bin/rm -rfv "dist/" "static/" "${BINARY}"

generate-dev:
	cd public && npm run dev
	mkdir -vp "static"
	cp -av public/index.html static/
	cp -av public/dist static/

generate:
	cd public && npm run build
	mkdir -vp "static"
	cp -av public/index.html static/
	cp -av public/dist static/
	$(GOPATH)/bin/rice -v embed-go

debug: fetch clean generate-dev ## Runs the application in debug mode.
	go run *.go -d --http.limit 2000 --update-url "http://hq.liam.sh/tmp/GeoLite2-City.mmdb.gz"

build: fetch clean generate ## Builds the application.
	go build -ldflags "${LD_FLAGS}" -i -v -o ${BINARY}

{'fraction_non_alphanumeric': 0.16848716548334244, 'fraction_numerical': 0.010376843255051884, 'mean_word_length': 3.7082262210796917, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, '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': '6210153', 'n_tokens_mistral': 1386, 'n_tokens_neox': 1331, 'n_words': 401}