Share version between API and fn tool (#525)

This commit is contained in:
Travis Reeder
2017-02-15 21:26:45 -08:00
committed by GitHub
parent 2890b909b1
commit 7f7d99feb4
4 changed files with 10 additions and 8 deletions

View File

@@ -4,11 +4,9 @@ import (
"net/http"
"github.com/gin-gonic/gin"
"github.com/iron-io/functions/api/version"
)
// Version of IronFunctions
var Version = "0.2.17"
func handleVersion(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{"version": Version})
c.JSON(http.StatusOK, gin.H{"version": version.Version})
}

4
api/version/version.go Normal file
View File

@@ -0,0 +1,4 @@
package version
// Version of IronFunctions
var Version = "0.2.16"

View File

@@ -5,12 +5,11 @@ import (
"net/url"
"os"
vers "github.com/iron-io/functions/api/version"
functions "github.com/iron-io/functions_go"
"github.com/urfave/cli"
)
const fnversion = "0.1.40"
var aliases = map[string]cli.Command{
"build": build(),
"bump": bump(),
@@ -33,7 +32,7 @@ func aliasesFn() []cli.Command {
func newFn() *cli.App {
app := cli.NewApp()
app.Name = "fn"
app.Version = fnversion
app.Version = vers.Version
app.Authors = []cli.Author{{Name: "iron.io"}}
app.Description = "IronFunctions command line tools"
app.UsageText = `Check the manual at https://github.com/iron-io/functions/blob/master/fn/README.md`

View File

@@ -5,6 +5,7 @@ import (
"net/url"
"os"
vers "github.com/iron-io/functions/api/version"
functions "github.com/iron-io/functions_go"
"github.com/urfave/cli"
)
@@ -34,7 +35,7 @@ func (r *versionCmd) version(c *cli.Context) error {
}
r.Configuration.BasePath = u.String()
fmt.Println("Client version:", fnversion)
fmt.Println("Client version:", vers.Version)
v, _, err := r.VersionGet()
if err != nil {
return err