TIBCOSoftware / flogo-cli

Project Flogo Command Line Interface
http://flogo.io
BSD 3-Clause "New" or "Revised" License
57 stars 28 forks source link

Add version command to flogo-cli #102

Closed retgits closed 6 years ago

retgits commented 6 years ago

What kind of change does this PR introduce? (check one with "x")

[] Bugfix
[X] Feature
[] Code style update (formatting, local variables)
[] Refactoring (no functional changes, no api changes)
[] Other... Please describe:

What is the current behavior? The current flogo-cli doesn't have a version command

What is the new behavior? This PR introduces the version command, and the output of the new command flogo version will be

$ flogo version
flogo cli version [v0.5.3-6-g12a4a61]
retgits commented 6 years ago

Updated the commit after a chat with @mellistibco. For flogo-contrib and flogo-lib we'll have to devise another way as the dep command doesn't download the vendored in dependencies as git repos (so we can't use git tags)

mellistibco commented 6 years ago

looks good for the cli version... As for flogo-lib and flogo-contrib perhaps we can parse the Gopkg.lock file and just assume that go dep is working as expected... The .lock will have the tag and revision:

[[projects]]
  name = "github.com/TIBCOSoftware/flogo-contrib"
  packages = [
    "action/flow",
    "action/flow/definition",
    "action/flow/instance",
    "action/flow/linker",
    "action/flow/model",
    "action/flow/model/simple",
    "action/flow/service",
    "action/flow/support",
    "action/flow/tester",
    "action/flow/util",
    "activity/inference",
    "activity/inference/framework",
    "activity/inference/framework/tf",
    "activity/inference/model",
    "activity/inference/tensorflow/tensorflow/core/example",
    "activity/inference/tensorflow/tensorflow/core/framework",
    "activity/inference/tensorflow/tensorflow/core/protobuf",
    "activity/inference/utils",
    "model/simple",
    "model/simple/behaviors",
    "trigger/cli"
  ]
  revision = "e127eb1b08cfa49f44a4d2e6ebf6a090ff34a1cd"
  version = "v0.5.3"
retgits commented 6 years ago

Yeah good idea! Let's use the same constructs as dep does. This PR now provides the following output:

λ flogo version
flogo cli version [v0.5.3-8-g2ceb92e]
Your project uses flogo-contrib version v0.5.3
Your project uses flogo-lib version v0.5.3

Project version information comes from the Gopkg files and the cli version comes from the git tags ([v0.5.3-8-g2ceb92e] means it uses a cli version that is 8 commits ahead of tagged version v0.5.3 with the git commit hash 2ceb92e so you can always point to the exact commit that is used)