Export glide.Version and create make verify-version
diff --git a/Makefile b/Makefile
index a71b9db..09a6c2f 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,8 @@
GLIDE_GO_EXECUTABLE ?= go
-VERSION := $(shell git describe --tags)
DIST_DIRS := find * -type d -exec
+VERSION := $(shell git describe --tags)
+VERSION_INCODE = $(shell perl -ne '/^const Version.*"([^"]+)".*$$/ && print "v$$1\n"' version.go)
+VERSION_INCHANGELOG = $(shell perl -ne '/^\# Release (\d+(\.\d+)+) / && print "$$1\n"' CHANGELOG.md | head -n1)
build:
${GLIDE_GO_EXECUTABLE} build -o glide -ldflags "-X main.version=${VERSION}" glide.go
@@ -27,7 +29,6 @@
cd ${GOPATH}/src/github.com/franciscocpg/gox && git checkout dc50315fc7992f4fa34a4ee4bb3d60052eeb038e
cd ${GOPATH}/src/github.com/franciscocpg/gox && ${GLIDE_GO_EXECUTABLE} install
-
build-all:
gox -verbose \
-ldflags "-X main.version=${VERSION}" \
@@ -44,5 +45,16 @@
$(DIST_DIRS) zip -r glide-${VERSION}-{}.zip {} \; && \
cd ..
+verify-version:
+ @if [ "$(VERSION_INCODE)" = "$(VERSION_INCHANGELOG)" ]; then \
+ echo "yarpc-go: $(VERSION_INCHANGELOG)"; \
+ elif [ "$(VERSION_INCODE)" = "$(VERSION_INCHANGELOG)-dev" ]; then \
+ echo "yarpc-go (development): $(VERSION_INCODE)"; \
+ else \
+ echo "Version number in version.go does not match CHANGELOG.md"; \
+ echo "version.go: $(VERSION_INCODE)"; \
+ echo "CHANGELOG : $(VERSION_INCHANGELOG)"; \
+ exit 1; \
+ fi
-.PHONY: build test install clean bootstrap-dist build-all dist integration-test
+.PHONY: build test install clean bootstrap-dist build-all dist integration-test verify-version
diff --git a/glide.go b/glide.go
index 5f9c14f..38c37a8 100644
--- a/glide.go
+++ b/glide.go
@@ -34,8 +34,6 @@
"os"
)
-var version = "0.13.0-dev"
-
const usage = `Vendor Package Management for your Go projects.
Each project should have a 'glide.yaml' file in the project directory. Files
@@ -60,7 +58,7 @@
app := cli.NewApp()
app.Name = "glide"
app.Usage = usage
- app.Version = version
+ app.Version = Version
app.Flags = []cli.Flag{
cli.StringFlag{
Name: "yaml, y",
diff --git a/version.go b/version.go
new file mode 100644
index 0000000..d188ff4
--- /dev/null
+++ b/version.go
@@ -0,0 +1,4 @@
+package main
+
+// Version is the current version of Glide
+const Version = "0.13.0-dev"