[ADD] all module add version show

This commit is contained in:
goodrain 2018-01-17 22:16:01 +08:00
parent 9cc261bd37
commit 37306dfefd
10 changed files with 86 additions and 22 deletions

View File

@ -1,34 +1,38 @@
// RAINBOND, Application Management Platform
// Copyright (C) 2014-2017 Goodrain Co., Ltd.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. For any non-GPL usage of Rainbond,
// one or multiple Commercial Licenses authorized by Goodrain Co., Ltd.
// must be obtained first.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package main
import (
"github.com/goodrain/rainbond/cmd/api/option"
"github.com/goodrain/rainbond/cmd/api/server"
"fmt"
"os"
"github.com/goodrain/rainbond/cmd"
"github.com/goodrain/rainbond/cmd/api/option"
"github.com/goodrain/rainbond/cmd/api/server"
"github.com/spf13/pflag"
)
func main() {
if len(os.Args) > 1 && os.Args[1] == "version" {
cmd.ShowVersion("api")
}
s := option.NewAPIServer()
s.AddFlags(pflag.CommandLine)
pflag.Parse()

View File

@ -1,19 +1,18 @@
// RAINBOND, Application Management Platform
// Copyright (C) 2014-2017 Goodrain Co., Ltd.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. For any non-GPL usage of Rainbond,
// one or multiple Commercial Licenses authorized by Goodrain Co., Ltd.
// must be obtained first.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
@ -23,6 +22,7 @@ import (
"fmt"
"os"
"github.com/goodrain/rainbond/cmd"
"github.com/goodrain/rainbond/cmd/builder/option"
"github.com/goodrain/rainbond/cmd/builder/server"
@ -30,6 +30,9 @@ import (
)
func main() {
if len(os.Args) > 1 && os.Args[1] == "version" {
cmd.ShowVersion("chaos")
}
s := option.NewBuilder()
s.AddFlags(pflag.CommandLine)
pflag.Parse()

View File

@ -1,19 +1,18 @@
// RAINBOND, Application Management Platform
// Copyright (C) 2014-2017 Goodrain Co., Ltd.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. For any non-GPL usage of Rainbond,
// one or multiple Commercial Licenses authorized by Goodrain Co., Ltd.
// must be obtained first.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
@ -23,6 +22,7 @@ import (
"fmt"
"os"
"github.com/goodrain/rainbond/cmd"
"github.com/goodrain/rainbond/cmd/entrance/option"
"github.com/goodrain/rainbond/cmd/entrance/server"
@ -30,6 +30,9 @@ import (
)
func main() {
if len(os.Args) > 1 && os.Args[1] == "version" {
cmd.ShowVersion("entrance")
}
s := option.NewACPLBServer()
s.AddFlags(pflag.CommandLine)
pflag.Parse()

View File

@ -1,19 +1,18 @@
// RAINBOND, Application Management Platform
// Copyright (C) 2014-2017 Goodrain Co., Ltd.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. For any non-GPL usage of Rainbond,
// one or multiple Commercial Licenses authorized by Goodrain Co., Ltd.
// must be obtained first.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
@ -22,12 +21,16 @@ package main
import (
"os"
"github.com/goodrain/rainbond/cmd"
"github.com/goodrain/rainbond/cmd/eventlog/server"
"github.com/spf13/pflag"
)
func main() {
if len(os.Args) > 1 && os.Args[1] == "version" {
cmd.ShowVersion("eventlog")
}
s := server.NewLogServer()
s.AddFlags(pflag.CommandLine)
pflag.Parse()

View File

@ -21,10 +21,15 @@ package main
import (
"fmt"
"os"
"github.com/goodrain/rainbond/cmd"
"github.com/goodrain/rainbond/cmd/grctl/server"
)
func main() {
if len(os.Args) > 1 && os.Args[1] == "version" {
cmd.ShowVersion("grctl")
}
if err := server.Run(); err != nil {
fmt.Fprintf(os.Stderr, "error: %v\n", err)
os.Exit(1)

View File

@ -30,6 +30,9 @@ import (
)
func main() {
if len(os.Args) > 1 && os.Args[1] == "version" {
cmd.ShowVersion("mq")
}
s := option.NewMQServer()
s.AddFlags(pflag.CommandLine)
pflag.Parse()

View File

@ -27,6 +27,9 @@ import (
)
func main() {
if len(os.Args) > 1 && os.Args[1] == "version" {
cmd.ShowVersion("node")
}
option.Init()
if err := server.Run(option.Config); err != nil {
fmt.Fprintf(os.Stderr, "error: %v\n", err)

33
cmd/version.go Normal file
View File

@ -0,0 +1,33 @@
// RAINBOND, Application Management Platform
// Copyright (C) 2014-2017 Goodrain Co., Ltd.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. For any non-GPL usage of Rainbond,
// one or multiple Commercial Licenses authorized by Goodrain Co., Ltd.
// must be obtained first.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd
import (
"fmt"
"os"
)
//CodeVersion 代码版本
const CodeVersion = "0.0.0"
//ShowVersion 显示版本
func ShowVersion(module string) {
fmt.Printf("Rainbond %s %s", module, CodeVersion)
os.Exit(0)
}

View File

@ -22,6 +22,7 @@ import (
"fmt"
"os"
"github.com/goodrain/rainbond/cmd"
"github.com/goodrain/rainbond/cmd/webcli/option"
"github.com/goodrain/rainbond/cmd/webcli/server"
@ -29,6 +30,9 @@ import (
)
func main() {
if len(os.Args) > 1 && os.Args[1] == "version" {
cmd.ShowVersion("webcli")
}
s := option.NewWebCliServer()
s.AddFlags(pflag.CommandLine)
pflag.Parse()

View File

@ -1,19 +1,18 @@
// RAINBOND, Application Management Platform
// Copyright (C) 2014-2017 Goodrain Co., Ltd.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. For any non-GPL usage of Rainbond,
// one or multiple Commercial Licenses authorized by Goodrain Co., Ltd.
// must be obtained first.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
@ -23,6 +22,7 @@ import (
"fmt"
"os"
"github.com/goodrain/rainbond/cmd"
"github.com/goodrain/rainbond/cmd/worker/option"
"github.com/goodrain/rainbond/cmd/worker/server"
@ -30,6 +30,9 @@ import (
)
func main() {
if len(os.Args) > 1 && os.Args[1] == "version" {
cmd.ShowVersion("worker")
}
s := option.NewWorker()
s.AddFlags(pflag.CommandLine)
pflag.Parse()