diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index fb50295c..7443e41d 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -63,8 +63,8 @@ }, { "ImportPath": "github.com/minio-io/cli", - "Comment": "1.2.0-106-g74f4efd", - "Rev": "74f4efdae47555906336b1dcd30c4b40d4d0d6fa" + "Comment": "1.2.0-107-ge085bd3", + "Rev": "e085bd36977e5eddf82401db2f16d91fb1d65412" }, { "ImportPath": "github.com/minio-io/minio/pkg/iodine", diff --git a/Godeps/_workspace/src/github.com/minio-io/cli/app.go b/Godeps/_workspace/src/github.com/minio-io/cli/app.go index 6caf336c..3e4dfa24 100644 --- a/Godeps/_workspace/src/github.com/minio-io/cli/app.go +++ b/Godeps/_workspace/src/github.com/minio-io/cli/app.go @@ -6,7 +6,6 @@ import ( "os" "os/exec" "strings" - "time" "io/ioutil" "text/tabwriter" @@ -45,7 +44,7 @@ type App struct { // Execute this function if the proper command cannot be found CommandNotFound func(context *Context, command string) // Compilation date - Compiled time.Time + Compiled string // ExtraInfo pass additional info as a key value map ExtraInfo map[string]string // List of all authors who contributed @@ -59,17 +58,17 @@ type App struct { } // mustCompileTime - determines the modification time of the current binary -func mustCompileTime() time.Time { +func mustCompileTime() string { path, err := exec.LookPath(os.Args[0]) if err != nil { - return time.Time{} + return "" } info, err := os.Stat(path) if err != nil { - return time.Time{} + return "" } - return info.ModTime() + return info.ModTime().String() } // NewApp - Creates a new cli Application with some reasonable defaults for Name, Usage, Version and Action. diff --git a/Godeps/_workspace/src/github.com/minio-io/cli/help.go b/Godeps/_workspace/src/github.com/minio-io/cli/help.go index caa219e6..10655754 100644 --- a/Godeps/_workspace/src/github.com/minio-io/cli/help.go +++ b/Godeps/_workspace/src/github.com/minio-io/cli/help.go @@ -14,21 +14,19 @@ var AppHelpTemplate = `NAME: USAGE: {{.Name}} {{if .Flags}}[global flags] {{end}}command{{if .Flags}} [command flags]{{end}} [arguments...] -VERSION: - {{.Version}} - -BUILD: - {{.Compiled}} -{{range $key, $value := .ExtraInfo}} -{{ $key }}: - {{ $value }} -{{ end }} COMMANDS: {{range .Commands}}{{join .Names ", "}}{{ "\t" }}{{.Usage}} {{end}}{{if .Flags}} GLOBAL FLAGS: {{range .Flags}}{{.}} {{end}}{{end}} +VERSION: + {{.Version}} +{{if .Compiled}} +BUILD: + {{.Compiled}}{{end}} +{{range $key, $value := .ExtraInfo}} +{{$value}}{{end}} ` // The text template for the command help topic. diff --git a/cmd-update.go b/cmd-update.go index b64cc88d..3f81e056 100644 --- a/cmd-update.go +++ b/cmd-update.go @@ -84,7 +84,12 @@ func runUpdateCmd(ctx *cli.Context) { log.Debug.Println(iodine.New(err, nil)) console.Fatalln("Unable to parse update time:", results.LatestBuild) } - if latest.After(ctx.App.Compiled) { + current, err := time.Parse(time.RFC3339Nano, ctx.App.Compiled) + if err != nil { + log.Debug.Println(iodine.New(err, nil)) + console.Fatalln("Unable to parse update time:", current) + } + if latest.After(current) { printUpdateNotify("new", "old") } case "yes": diff --git a/main.go b/main.go index b7903525..8e2b3f99 100644 --- a/main.go +++ b/main.go @@ -53,6 +53,18 @@ func checkConfig() { } } +// Build date +var BuildDate string + +// getBuildDate - +func getBuildDate() string { + if BuildDate == "" { + return "" + } + t, _ := time.Parse(time.RFC3339Nano, BuildDate) + return t.String() +} + // Get os/arch/platform specific information. // Returns a map of current os/arch/platform/memstats func getSystemData() map[string]string { @@ -82,15 +94,12 @@ func getSystemData() map[string]string { // Version is based on MD5SUM of its binary var Version = mustHashBinarySelf() -// Build date -var BuildDate string - func main() { app := cli.NewApp() app.Usage = "Minio Client for object storage and filesystems" app.Version = Version app.Commands = commands - app.Compiled, _ = time.Parse(time.RFC3339Nano, BuildDate) + app.Compiled = getBuildDate() app.Flags = flags app.Author = "Minio.io" app.Before = func(ctx *cli.Context) error {