From cef7a1aae4205ebf4fbd8958f1f870ff69759edf Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Wed, 16 Sep 2015 17:37:11 -0700 Subject: PLT-92 Adding server side versioning to the binary --- mattermost.go | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'mattermost.go') diff --git a/mattermost.go b/mattermost.go index 0bdb90424..75e405e88 100644 --- a/mattermost.go +++ b/mattermost.go @@ -23,6 +23,7 @@ import ( var flagCmdCreateTeam bool var flagCmdCreateUser bool var flagCmdAssignRole bool +var flagCmdVersion bool var flagCmdResetPassword bool var flagConfigFile string var flagEmail string @@ -83,14 +84,16 @@ func parseCmds() { flag.BoolVar(&flagCmdCreateTeam, "create_team", false, "") flag.BoolVar(&flagCmdCreateUser, "create_user", false, "") flag.BoolVar(&flagCmdAssignRole, "assign_role", false, "") + flag.BoolVar(&flagCmdVersion, "version", false, "") flag.BoolVar(&flagCmdResetPassword, "reset_password", false, "") flag.Parse() - flagRunCmds = flagCmdCreateTeam || flagCmdCreateUser || flagCmdAssignRole || flagCmdResetPassword + flagRunCmds = flagCmdCreateTeam || flagCmdCreateUser || flagCmdAssignRole || flagCmdResetPassword || flagCmdVersion } func runCmds() { + cmdVersion() cmdCreateTeam() cmdCreateUser() cmdAssignRole() @@ -184,6 +187,16 @@ func cmdCreateUser() { } } +func cmdVersion() { + if flagCmdVersion { + fmt.Fprintln(os.Stderr, "Version: "+model.GetFullVersion()) + fmt.Fprintln(os.Stderr, "Build Number: "+model.BUILD_NUMBER) + fmt.Fprintln(os.Stderr, "Build Date: "+model.BUILD_DATE) + + os.Exit(0) + } +} + func cmdAssignRole() { if flagCmdAssignRole { if len(flagTeamName) == 0 { @@ -298,6 +311,8 @@ Usage: platform [options] + -version Display the current version + -config="config.json" Path to the config file -email="user@example.com" Email address used in other commands -- cgit v1.2.3-1-g7c22 From 1e7f7852ad09d97c8d33012192bd1ff418881b8f Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Wed, 16 Sep 2015 17:49:48 -0700 Subject: Outputing version to logs on server start --- mattermost.go | 1 + 1 file changed, 1 insertion(+) (limited to 'mattermost.go') diff --git a/mattermost.go b/mattermost.go index 75e405e88..b2b5f584b 100644 --- a/mattermost.go +++ b/mattermost.go @@ -43,6 +43,7 @@ func main() { } pwd, _ := os.Getwd() + l4g.Info("Current version is %v (%v/%v)", model.GetFullVersion(), model.BUILD_NUMBER, model.BUILD_DATE) l4g.Info("Current working directory is %v", pwd) l4g.Info("Loaded config file from %v", utils.FindConfigFile(flagConfigFile)) -- cgit v1.2.3-1-g7c22 From af4deb2369ee6251d7f49db1d67808b773dd9db7 Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Thu, 17 Sep 2015 13:01:40 -0700 Subject: Making changes to versioning --- mattermost.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'mattermost.go') diff --git a/mattermost.go b/mattermost.go index b2b5f584b..f54bcf15f 100644 --- a/mattermost.go +++ b/mattermost.go @@ -43,7 +43,7 @@ func main() { } pwd, _ := os.Getwd() - l4g.Info("Current version is %v (%v/%v)", model.GetFullVersion(), model.BUILD_NUMBER, model.BUILD_DATE) + l4g.Info("Current version is %v (%v/%v/%v)", model.CurrentVersion, model.BuildNumber, model.BuildDate, model.BuildHash) l4g.Info("Current working directory is %v", pwd) l4g.Info("Loaded config file from %v", utils.FindConfigFile(flagConfigFile)) @@ -190,9 +190,10 @@ func cmdCreateUser() { func cmdVersion() { if flagCmdVersion { - fmt.Fprintln(os.Stderr, "Version: "+model.GetFullVersion()) - fmt.Fprintln(os.Stderr, "Build Number: "+model.BUILD_NUMBER) - fmt.Fprintln(os.Stderr, "Build Date: "+model.BUILD_DATE) + fmt.Fprintln(os.Stderr, "Version: "+model.CurrentVersion) + fmt.Fprintln(os.Stderr, "Build Number: "+model.BuildNumber) + fmt.Fprintln(os.Stderr, "Build Date: "+model.BuildDate) + fmt.Fprintln(os.Stderr, "Build Hash: "+model.BuildHash) os.Exit(0) } -- cgit v1.2.3-1-g7c22