<commit_before>include golang.mk
.DEFAULT_GOAL := test # override default goal set in library makefile
.PHONY: test build release
PKG := github.com/Clever/wag
PKGS := $(shell go list ./... | grep -v /vendor | grep -v /samples/gen* | grep -v /hardcoded)
VERSION := $(shell head -n 1 VERSION)
EXECUTABLE := wag

$(eval $(call golang-version-check,1.8))

MOCKGEN := $(GOPATH)/bin/mockgen
.PHONY: $(MOCKGEN)
$(MOCKGEN):
	go get -u github.com/golang/mock/mockgen

build: hardcoded/hardcoded.go
	go build -o bin/wag

test: build generate $(PKGS) js-tests

js-tests:
	cd test/js && rm -rf node_modules && npm install && npm test

jsdoc2md:
	hash npm 2>/dev/null || (echo "Could not run npm, please install node" && false)
	hash jsdoc2md 2>/dev/null || npm install -g jsdoc-to-markdown@^2.0.0

generate: hardcoded/hardcoded.go $(MOCKGEN) jsdoc2md
	./bin/wag -file samples/swagger.yml -go-package $(PKG)/samples/gen-go -js-path $(GOPATH)/src/$(PKG)/samples/gen-js<commit_msg>lock mockgen version since new version breaks test<commit_after>include golang.mk
.DEFAULT_GOAL := test # override default goal set in library makefile
.PHONY: test build release
PKG := github.com/Clever/wag
PKGS := $(shell go list ./... | grep -v /vendor | grep -v /samples/gen* | grep -v /hardcoded)
VERSION := $(shell head -n 1 VERSION)
EXECUTABLE := wag

$(eval $(call golang-version-check,1.8))

MOCKGEN := $(GOPATH)/bin/mockgen
MOCKGEN_VERSION = dbe9dea30dbc5b4b6d54c9ecf9a3b8f9b8e6556c
$(GOPATH)/src/github.com/golang/mock:
	git clone https://github.com/golang/mock.git $(GOPATH)/src/github.com/golang/mock
	cd $(GOPATH)/src/github.com/golang/mock && git reset --hard $(MOCKGEN_VERSION)

$(MOCKGEN): $(GOPATH)/src/github.com/golang/mock
	go build -o $(GOPATH)/bin/mockgen github.com/golang/mock/mockgen


build: hardcoded/hardcoded.go
	go build -o bin/wag

test: build generate $(PKGS) js-tests

js-tests:
	cd test/js && rm -rf node_modules && npm install && npm test

jsdoc2md:
	hash npm 2>/dev/null || (echo "Could not run npm, please install node" && false)
	hash jsdoc2md 2>/dev/null || npm install -g jsdoc-to-markdown@^2.0.0

generate: hardcoded/hardcoded.go $(MOCKGEN) jsdoc2md
	./bin/wag -file samples/swagger.yml -go-package $(PKG)/samples/gen-go -js-path $(GOPATH)/src/$(PKG)/samples/gen-js
{'fraction_non_alphanumeric': 0.15574131104267488, 'fraction_numerical': 0.01759788825340959, 'mean_word_length': 4.030973451327434, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 1, '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': '2901170', 'n_tokens_mistral': 911, 'n_tokens_neox': 851, 'n_words': 223}