Merge pull request #126 from tendermint/124-version-command

version command
This commit is contained in:
Anton Kaliaev 2017-11-09 17:08:02 -05:00 committed by GitHub
commit 0f96d5d1f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 33 additions and 20 deletions

View File

@ -15,10 +15,10 @@ protoc:
@ protoc --go_out=plugins=grpc:. types/*.proto @ protoc --go_out=plugins=grpc:. types/*.proto
install: install:
@ go install github.com/tendermint/abci/cmd/... @ go install ./cmd/...
build: build:
@ go build -i github.com/tendermint/abci/cmd/... @ go build -i ./cmd/...
dist: dist:
@ bash scripts/dist.sh @ bash scripts/dist.sh

View File

@ -15,6 +15,7 @@ import (
"github.com/tendermint/abci/example/dummy" "github.com/tendermint/abci/example/dummy"
"github.com/tendermint/abci/server" "github.com/tendermint/abci/server"
"github.com/tendermint/abci/types" "github.com/tendermint/abci/types"
"github.com/tendermint/abci/version"
cmn "github.com/tendermint/tmlibs/common" cmn "github.com/tendermint/tmlibs/common"
"github.com/tendermint/tmlibs/log" "github.com/tendermint/tmlibs/log"
@ -71,8 +72,9 @@ var RootCmd = &cobra.Command{
PersistentPreRunE: func(cmd *cobra.Command, args []string) error { PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
switch cmd.Use { switch cmd.Use {
// for the examples apps, don't pre-run case "counter", "dummy": // for the examples apps, don't pre-run
case "counter", "dummy": return nil
case "version": // skip running for version command
return nil return nil
} }
@ -130,6 +132,7 @@ func addCommands() {
RootCmd.AddCommand(deliverTxCmd) RootCmd.AddCommand(deliverTxCmd)
RootCmd.AddCommand(checkTxCmd) RootCmd.AddCommand(checkTxCmd)
RootCmd.AddCommand(commitCmd) RootCmd.AddCommand(commitCmd)
RootCmd.AddCommand(versionCmd)
addQueryFlags() addQueryFlags()
RootCmd.AddCommand(queryCmd) RootCmd.AddCommand(queryCmd)
@ -219,6 +222,17 @@ var commitCmd = &cobra.Command{
}, },
} }
var versionCmd = &cobra.Command{
Use: "version",
Short: "Print abci console version",
Long: "",
Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) error {
fmt.Println(version.Version)
return nil
},
}
var queryCmd = &cobra.Command{ var queryCmd = &cobra.Command{
Use: "query", Use: "query",
Short: "Query the application state", Short: "Query the application state",

View File

@ -8,7 +8,7 @@ import (
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
abcicli "github.com/tendermint/abci/client" abcicli "github.com/tendermint/abci/client"
"github.com/tendermint/abci/server" abciserver "github.com/tendermint/abci/server"
"github.com/tendermint/abci/types" "github.com/tendermint/abci/types"
"github.com/tendermint/iavl" "github.com/tendermint/iavl"
cmn "github.com/tendermint/tmlibs/common" cmn "github.com/tendermint/tmlibs/common"
@ -210,7 +210,7 @@ func makeSocketClientServer(app types.Application, name string) (abcicli.Client,
socket := cmn.Fmt("unix://%s.sock", name) socket := cmn.Fmt("unix://%s.sock", name)
logger := log.TestingLogger() logger := log.TestingLogger()
server := server.NewSocketServer(socket, app) server := abciserver.NewSocketServer(socket, app)
server.SetLogger(logger.With("module", "abci-server")) server.SetLogger(logger.With("module", "abci-server"))
if _, err := server.Start(); err != nil { if _, err := server.Start(); err != nil {
return nil, nil, err return nil, nil, err
@ -233,7 +233,7 @@ func makeGRPCClientServer(app types.Application, name string) (abcicli.Client, c
logger := log.TestingLogger() logger := log.TestingLogger()
gapp := types.NewGRPCApplication(app) gapp := types.NewGRPCApplication(app)
server := server.NewGRPCServer(socket, gapp) server := abciserver.NewGRPCServer(socket, gapp)
server.SetLogger(logger.With("module", "abci-server")) server.SetLogger(logger.With("module", "abci-server"))
if _, err := server.Start(); err != nil { if _, err := server.Start(); err != nil {
return nil, nil, err return nil, nil, err

View File

@ -13,7 +13,7 @@ import (
abcicli "github.com/tendermint/abci/client" abcicli "github.com/tendermint/abci/client"
"github.com/tendermint/abci/example/dummy" "github.com/tendermint/abci/example/dummy"
"github.com/tendermint/abci/server" abciserver "github.com/tendermint/abci/server"
"github.com/tendermint/abci/types" "github.com/tendermint/abci/types"
cmn "github.com/tendermint/tmlibs/common" cmn "github.com/tendermint/tmlibs/common"
"github.com/tendermint/tmlibs/log" "github.com/tendermint/tmlibs/log"
@ -38,7 +38,7 @@ func testStream(t *testing.T, app types.Application) {
numDeliverTxs := 200000 numDeliverTxs := 200000
// Start the listener // Start the listener
server := server.NewSocketServer("unix://test.sock", app) server := abciserver.NewSocketServer("unix://test.sock", app)
server.SetLogger(log.TestingLogger().With("module", "abci-server")) server.SetLogger(log.TestingLogger().With("module", "abci-server"))
if _, err := server.Start(); err != nil { if _, err := server.Start(); err != nil {
t.Fatalf("Error starting socket server: %v", err.Error()) t.Fatalf("Error starting socket server: %v", err.Error())
@ -111,7 +111,7 @@ func testGRPCSync(t *testing.T, app *types.GRPCApplication) {
numDeliverTxs := 2000 numDeliverTxs := 2000
// Start the listener // Start the listener
server := server.NewGRPCServer("unix://test.sock", app) server := abciserver.NewGRPCServer("unix://test.sock", app)
server.SetLogger(log.TestingLogger().With("module", "abci-server")) server.SetLogger(log.TestingLogger().With("module", "abci-server"))
if _, err := server.Start(); err != nil { if _, err := server.Start(); err != nil {
t.Fatalf("Error starting GRPC server: %v", err.Error()) t.Fatalf("Error starting GRPC server: %v", err.Error())

11
glide.lock generated
View File

@ -1,5 +1,5 @@
hash: 3c8680f0a289567a29f737be5f1d5f242c7e2afd84bdd023dd74596b88508fc2 hash: 5501ab3d7136aa8fb425c995d45221849b33aefab76c5d2c192e721dad28da38
updated: 2017-10-27T12:12:58.940745472-04:00 updated: 2017-11-08T22:19:19.433856551Z
imports: imports:
- name: github.com/btcsuite/btcd - name: github.com/btcsuite/btcd
version: b8df516b4b267acf2de46be593a9d948d1d2c420 version: b8df516b4b267acf2de46be593a9d948d1d2c420
@ -66,20 +66,19 @@ imports:
- edwards25519 - edwards25519
- extra25519 - extra25519
- name: github.com/tendermint/go-crypto - name: github.com/tendermint/go-crypto
version: db5603e37435933c13665a708055fadd18222f5f version: b4f04f196cd719660e43b91202cd60d9a95b1837
- name: github.com/tendermint/go-wire - name: github.com/tendermint/go-wire
version: 8ee84b5b2581530168daf66fc89c548d27403c57 version: 2baffcb6b690057568bc90ef1d457efb150b979a
subpackages: subpackages:
- data - data
- name: github.com/tendermint/iavl - name: github.com/tendermint/iavl
version: 595f3dcd5b6cd4a292e90757ae6d367fd7a6e653 version: 595f3dcd5b6cd4a292e90757ae6d367fd7a6e653
- name: github.com/tendermint/tmlibs - name: github.com/tendermint/tmlibs
version: 092eb701c7276907cdbed258750e22ce895b6735 version: 176c2ceed611d7735e39131e312bd973afb41b7b
subpackages: subpackages:
- common - common
- db - db
- log - log
- merkle
- process - process
- name: golang.org/x/crypto - name: golang.org/x/crypto
version: c7af5bf2638a1164f2eb5467c39c6cffbd13a02e version: c7af5bf2638a1164f2eb5467c39c6cffbd13a02e

View File

@ -3,11 +3,13 @@ import:
- package: github.com/golang/protobuf - package: github.com/golang/protobuf
subpackages: subpackages:
- proto - proto
- package: github.com/pkg/errors - package: github.com/spf13/cobra
- package: github.com/tendermint/go-crypto - package: github.com/tendermint/go-crypto
version: develop version: develop
- package: github.com/tendermint/go-wire - package: github.com/tendermint/go-wire
version: develop version: develop
subpackages:
- data
- package: github.com/tendermint/iavl - package: github.com/tendermint/iavl
version: develop version: develop
- package: github.com/tendermint/tmlibs - package: github.com/tendermint/tmlibs
@ -16,10 +18,7 @@ import:
- common - common
- db - db
- log - log
- merkle
- process - process
- package: github.com/spf13/cobra
version: master
- package: golang.org/x/net - package: golang.org/x/net
subpackages: subpackages:
- context - context
@ -27,4 +26,5 @@ import:
testImport: testImport:
- package: github.com/stretchr/testify - package: github.com/stretchr/testify
subpackages: subpackages:
- assert
- require - require