diff --git a/main.go b/main.go index 761304d858..0b9eb758d5 100644 --- a/main.go +++ b/main.go @@ -7,6 +7,7 @@ import ( log "github.com/Sirupsen/logrus" "github.com/codegangsta/cli" "github.com/docker/machine/utils" + "github.com/docker/machine/version" ) func main() { @@ -28,7 +29,7 @@ func main() { app.Commands = Commands app.CommandNotFound = cmdNotFound app.Usage = "Create and manage machines running Docker." - app.Version = VERSION + app.Version = version.VERSION + " (" + version.GITCOMMIT + ")" app.Flags = []cli.Flag{ cli.BoolFlag{ diff --git a/script/build b/script/build index 3b16d12b2c..bb4b44071d 100755 --- a/script/build +++ b/script/build @@ -15,4 +15,4 @@ fi docker build -t docker-machine . rm -f docker-machine* -exec docker run --rm -v `pwd`:/go/src/github.com/docker/machine docker-machine gox "${OS_PLATFORM_ARG[@]}" "${OS_ARCH_ARG[@]}" -output="docker-machine_{{.OS}}-{{.Arch}}" +exec docker run --rm -v `pwd`:/go/src/github.com/docker/machine docker-machine gox "${OS_PLATFORM_ARG[@]}" "${OS_ARCH_ARG[@]}" -output="docker-machine_{{.OS}}-{{.Arch}}" -ldflags="-w -X github.com/docker/machine/version.GITCOMMIT `git rev-parse --short HEAD`" diff --git a/version.go b/version.go deleted file mode 100644 index a44ae0ec70..0000000000 --- a/version.go +++ /dev/null @@ -1,3 +0,0 @@ -package main - -const VERSION = "0.1.0" diff --git a/version/version.go b/version/version.go new file mode 100644 index 0000000000..13b230aeca --- /dev/null +++ b/version/version.go @@ -0,0 +1,9 @@ +package version + +var ( + // VERSION should be updated by hand at each release + VERSION = "0.1.0" + + // GITCOMMIT will be overritten automatically by the build system + GITCOMMIT = "HEAD" +) diff --git a/version/version_test.go b/version/version_test.go new file mode 100644 index 0000000000..f37d99d0c2 --- /dev/null +++ b/version/version_test.go @@ -0,0 +1 @@ +package version