fix version

This commit is contained in:
Kevin Schoon 2018-01-21 23:38:17 +08:00
parent 1aeefe0ad9
commit 0ada6d0972
3 changed files with 14 additions and 6 deletions

View File

@ -1,15 +1,23 @@
VERSION ?= $(shell git describe --tags 2>/dev/null)
ifeq "$(VERSION)" ""
VERSION := UNKNOWN
endif
.PHONY: \ .PHONY: \
all all \
test
all: bin/pomo all: bin/pomo
clean: clean:
rm -v bin/pomo bindata.go rm -v bin/* 2> /dev/null || true
bindata.go: bindata.go:
go-bindata -pkg main -o $@ tomato-icon.png go-bindata -pkg main -o $@ tomato-icon.png
test:
go test ./...
bin/pomo: bindata.go bin/pomo: bindata.go
mkdir bin 2>/dev/null @echo mkdir bin 2>/dev/null || true
go build -o bin/pomo go build -ldflags "-X main.Version=$(VERSION)" -o bin/pomo

View File

@ -97,7 +97,7 @@ func main() {
var ( var (
path = app.StringOpt("p path", defaultConfigPath(), "path to the pomo config directory") path = app.StringOpt("p path", defaultConfigPath(), "path to the pomo config directory")
) )
app.Version("v version", version) app.Version("v version", Version)
app.Command("start s", "start a new task", start(path)) app.Command("start s", "start a new task", start(path))
app.Command("init", "initialize the sqlite database", initialize(path)) app.Command("init", "initialize the sqlite database", initialize(path))
app.Command("list l", "list historical tasks", list(path)) app.Command("list l", "list historical tasks", list(path))

View File

@ -1,3 +1,3 @@
package main package main
var version = "undefined" var Version = "undefined"