diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..9a4ff8eb --- /dev/null +++ b/Makefile @@ -0,0 +1,38 @@ +#@IgnoreInspection BashAddShebang + +BINARY=gosonic + +SOURCES := $(shell find . -name '*.go') + +all: $(BINARY) + +$(BINARY): $(SOURCES) + go build + +.PHONY: clean +clean: + rm -f ${BINARY} + +.PHONY: setup +setup: + go get -u github.com/beego/bee # bee command line tool + go get -u github.com/smartystreets/goconvey # test runnner + go get -u github.com/kardianos/govendor # dependency manager + govendor sync # download all dependencies + +.PHONY: run +run: + bee run -e vendor -e tests + +.PHONY: test +test: + BEEGO_RUNMODE=test go test `go list ./...|grep -v vendor` -v + +.PHONY: convey +convey: + NOLOG=1 goconvey --port 9090 -excludedDirs vendor,static,devDb,wiki,bin,tests + +.PHONY: cloc +cloc: + # cloc can be installed using brew + cloc --exclude-dir=devDb,.idea,.vscode,wiki,static,vendor --exclude-ext=iml,xml . diff --git a/README.md b/README.md index 993b515c..750637df 100644 --- a/README.md +++ b/README.md @@ -44,19 +44,17 @@ You will need to install [Go 1.7](https://golang.org/dl/) Then install dependencies: ``` -$ go get github.com/beego/bee # bee command line tool -$ go get github.com/kardianos/govendor # dependency manager -$ govendor fetch +$ make setup ``` -From here it's a normal [BeeGo](http://beego.me) development cycle. Some useful commands: +Some useful commands: ```bash # Start local server (with hot reload) -$ bee run +$ make run # Run all tests -$ go test `go list ./...|grep -v vendor` -v +$ make test ```