magnetico/Makefile

66 lines
1.7 KiB
Makefile
Raw Normal View History

2019-05-19 00:27:10 +00:00
.PHONY: test format vet staticcheck magneticod magneticow image image-magneticow image-magneticod
2018-08-07 07:31:26 +00:00
2018-08-27 08:15:01 +00:00
all: test magneticod magneticow
magneticod:
2019-05-19 10:20:17 +00:00
go install --tags fts5 "-ldflags=-s -w -X main.compiledOn=`date -u +%Y-%m-%dT%H:%M:%SZ`" ./cmd/magneticod
magneticow:
# TODO: minify files!
# https://github.com/kevinburke/go-bindata
2018-08-27 08:15:01 +00:00
go-bindata -o="cmd/magneticow/bindata.go" -prefix="cmd/magneticow/data/" cmd/magneticow/data/...
2019-05-19 10:20:17 +00:00
go install --tags fts5 "-ldflags=-s -w -X main.compiledOn=`date -u +%Y-%m-%dT%H:%M:%SZ`" ./cmd/magneticow
.PHONY: docker
docker: docker_up docker_logs
.PHONY: docker_up
docker_up:
docker-compose up -d
.PHONY: docker_down
docker_down:
docker-compose down
.PHONY: docker_logs
docker_logs:
docker-compose logs -ft --tail=10
2018-08-27 08:15:01 +00:00
image-magneticod:
2019-09-18 01:27:04 +00:00
docker build -t boramalper/magneticod -f Dockerfile.magneticod .
2018-08-27 08:15:01 +00:00
image-magneticow:
2019-09-18 01:27:04 +00:00
docker build -t boramalper/magneticow -f Dockerfile.magneticow .
2018-08-27 08:15:01 +00:00
image: image-magneticod image-magneticow
vet:
2019-05-19 16:22:22 +00:00
go vet ./...
2018-08-27 08:15:01 +00:00
staticcheck:
2019-05-19 16:22:22 +00:00
staticcheck ./...
2018-08-27 08:15:01 +00:00
test:
2019-05-19 16:22:22 +00:00
go test ./...
2018-08-27 08:15:01 +00:00
format:
2019-05-19 16:22:22 +00:00
gofmt -w ./cmd/
gofmt -w ./pkg/
# Formatting Errors
# Since gofmt returns zero even if there are files to be formatted, we use:
#
# ! gofmt -d ${GOPATH}/path/ 2>&1 | read
#
# to return 1 if there are files to be formatted, and 0 if not.
# https://groups.google.com/forum/#!topic/Golang-Nuts/pdrN4zleUio
#
# How can I use Bash syntax in Makefile targets?
# Because `read` is a bash command.
# https://stackoverflow.com/a/589300/4466589
#
check-formatting: SHELL:=/bin/bash # HERE: this is setting the shell for check-formatting only
check-formatting:
2019-05-19 16:22:22 +00:00
! gofmt -l ./cmd/ 2>&1 | tee /dev/fd/2 | read
! gofmt -l ./pkg/ 2>&1 | tee /dev/fd/2 | read