Refactor Hugo version

Put version handling into the helpers package so it can be used by many,
and split version and suffix to make it possible to calculate the next Hugo version.
This commit is contained in:
bep 2015-03-18 12:23:13 +01:00
parent 49f20bbc9b
commit 3273fce044
4 changed files with 64 additions and 6 deletions

View file

@ -22,6 +22,7 @@ import (
"github.com/kardianos/osext"
"github.com/spf13/cobra"
"github.com/spf13/hugo/helpers"
"github.com/spf13/hugo/hugolib"
)
@ -38,9 +39,9 @@ var version = &cobra.Command{
formatBuildDate() // format the compile time
}
if hugolib.CommitHash == "" {
fmt.Printf("Hugo Static Site Generator v%s BuildDate: %s\n", hugolib.Version, hugolib.BuildDate)
fmt.Printf("Hugo Static Site Generator v%s BuildDate: %s\n", helpers.HugoVersion(), hugolib.BuildDate)
} else {
fmt.Printf("Hugo Static Site Generator v%s-%s BuildDate: %s\n", hugolib.Version, strings.ToUpper(hugolib.CommitHash), hugolib.BuildDate)
fmt.Printf("Hugo Static Site Generator v%s-%s BuildDate: %s\n", helpers.HugoVersion(), strings.ToUpper(hugolib.CommitHash), hugolib.BuildDate)
}
},
}