Commit
+14 -6 +/-3 browse
1 | diff --git a/Makefile b/Makefile |
2 | index 90f1f99..5652ead 100644 |
3 | --- a/Makefile |
4 | +++ b/Makefile |
5 | @@ -1,15 +1,23 @@ |
6 | + VERSION ?= $(shell git describe --tags 2>/dev/null) |
7 | + ifeq "$(VERSION)" "" |
8 | + VERSION := UNKNOWN |
9 | + endif |
10 | |
11 | .PHONY: \ |
12 | - all |
13 | + all \ |
14 | + test |
15 | |
16 | all: bin/pomo |
17 | |
18 | clean: |
19 | - rm -v bin/pomo bindata.go |
20 | + rm -v bin/* 2> /dev/null || true |
21 | |
22 | bindata.go: |
23 | go-bindata -pkg main -o $@ tomato-icon.png |
24 | |
25 | + test: |
26 | + go test ./... |
27 | + |
28 | bin/pomo: bindata.go |
29 | - mkdir bin 2>/dev/null |
30 | - go build -o bin/pomo |
31 | + @echo mkdir bin 2>/dev/null || true |
32 | + go build -ldflags "-X main.Version=$(VERSION)" -o bin/pomo |
33 | diff --git a/main.go b/main.go |
34 | index 9b02488..4669ba7 100644 |
35 | --- a/main.go |
36 | +++ b/main.go |
37 | @@ -97,7 +97,7 @@ func main() { |
38 | var ( |
39 | path = app.StringOpt("p path", defaultConfigPath(), "path to the pomo config directory") |
40 | ) |
41 | - app.Version("v version", version) |
42 | + app.Version("v version", Version) |
43 | app.Command("start s", "start a new task", start(path)) |
44 | app.Command("init", "initialize the sqlite database", initialize(path)) |
45 | app.Command("list l", "list historical tasks", list(path)) |
46 | diff --git a/version.go b/version.go |
47 | index 2eddb8a..3cb07c8 100644 |
48 | --- a/version.go |
49 | +++ b/version.go |
50 | @@ -1,3 +1,3 @@ |
51 | package main |
52 | |
53 | - var version = "undefined" |
54 | + var Version = "undefined" |