mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Share version between API and fn tool (#525)
This commit is contained in:
@@ -4,11 +4,9 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"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) {
|
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
4
api/version/version.go
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
package version
|
||||||
|
|
||||||
|
// Version of IronFunctions
|
||||||
|
var Version = "0.2.16"
|
||||||
@@ -5,12 +5,11 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
vers "github.com/iron-io/functions/api/version"
|
||||||
functions "github.com/iron-io/functions_go"
|
functions "github.com/iron-io/functions_go"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
const fnversion = "0.1.40"
|
|
||||||
|
|
||||||
var aliases = map[string]cli.Command{
|
var aliases = map[string]cli.Command{
|
||||||
"build": build(),
|
"build": build(),
|
||||||
"bump": bump(),
|
"bump": bump(),
|
||||||
@@ -33,7 +32,7 @@ func aliasesFn() []cli.Command {
|
|||||||
func newFn() *cli.App {
|
func newFn() *cli.App {
|
||||||
app := cli.NewApp()
|
app := cli.NewApp()
|
||||||
app.Name = "fn"
|
app.Name = "fn"
|
||||||
app.Version = fnversion
|
app.Version = vers.Version
|
||||||
app.Authors = []cli.Author{{Name: "iron.io"}}
|
app.Authors = []cli.Author{{Name: "iron.io"}}
|
||||||
app.Description = "IronFunctions command line tools"
|
app.Description = "IronFunctions command line tools"
|
||||||
app.UsageText = `Check the manual at https://github.com/iron-io/functions/blob/master/fn/README.md`
|
app.UsageText = `Check the manual at https://github.com/iron-io/functions/blob/master/fn/README.md`
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
vers "github.com/iron-io/functions/api/version"
|
||||||
functions "github.com/iron-io/functions_go"
|
functions "github.com/iron-io/functions_go"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
@@ -34,7 +35,7 @@ func (r *versionCmd) version(c *cli.Context) error {
|
|||||||
}
|
}
|
||||||
r.Configuration.BasePath = u.String()
|
r.Configuration.BasePath = u.String()
|
||||||
|
|
||||||
fmt.Println("Client version:", fnversion)
|
fmt.Println("Client version:", vers.Version)
|
||||||
v, _, err := r.VersionGet()
|
v, _, err := r.VersionGet()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
Reference in New Issue
Block a user