Skip to content

Commit

Permalink
mir:update version to v2.7.0; mirc:support custom mir and engine's ve…
Browse files Browse the repository at this point in the history
…rsion in cli option
  • Loading branch information
alimy committed Apr 10, 2021
1 parent 62ab2a5 commit 4a66f79
Show file tree
Hide file tree
Showing 21 changed files with 43 additions and 454 deletions.
6 changes: 6 additions & 0 deletions mirc/cmd/new.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ var (
pkgName string
style []string
mirPkgName string
mirVersion string
engVersion string
)

func init() {
Expand All @@ -35,6 +37,8 @@ func init() {
newCmd.Flags().StringVarP(&pkgName, "pkg", "p", "github.com/alimy/mir-example", "project's package name")
newCmd.Flags().StringSliceVarP(&style, "style", "s", []string{"gin"}, "generated engine style eg: gin,chi,mux,echo,iris,fiber,fiber-v2,macaron,httprouter")
newCmd.Flags().StringVar(&mirPkgName, "mir", "", "mir replace package name or place")
newCmd.Flags().StringVar(&mirVersion, "mir-version", "", "set mir version")
newCmd.Flags().StringVar(&engVersion, "engine-version", "", "set engine version")

// register agentCmd as sub-command
register(newCmd)
Expand All @@ -61,6 +65,8 @@ func newRun(_cmd *cobra.Command, _args []string) {
ctx := &templates.TmplCtx{
PkgName: pkgName,
MirPkgName: mirPkgName,
MirVersion: mirVersion,
EngVersion: engVersion,
}
if err = genProject(ctx, path, style); err != nil {
log.Fatal(err)
Expand Down
4 changes: 2 additions & 2 deletions mirc/cmd/templates/chi/go.mod.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ module {{ .PkgName }}
go 1.16

require (
github.com/alimy/mir/v2 v2.7.0-alpha
github.com/go-chi/chi v4.1.2+incompatible
github.com/alimy/mir/v2 {{ .VersionOfMir "v2.7.0" }}
github.com/go-chi/chi {{ .VersionOfEngine "v4.1.2+incompatible" }}
)
{{if notEmptyStr .MirPkgName }}
replace (
Expand Down
2 changes: 0 additions & 2 deletions mirc/cmd/templates/chi/go.sum.tmpl

This file was deleted.

4 changes: 2 additions & 2 deletions mirc/cmd/templates/echo/go.mod.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ module {{ .PkgName }}
go 1.16

require (
github.com/alimy/mir/v2 v2.7.0-alpha
github.com/labstack/echo/v4 v4.1.17
github.com/alimy/mir/v2 {{ .VersionOfMir "v2.7.0" }}
github.com/labstack/echo/v4 {{ .VersionOfEngine "v4.1.17" }}
)
{{if notEmptyStr .MirPkgName }}
replace (
Expand Down
48 changes: 0 additions & 48 deletions mirc/cmd/templates/echo/go.sum.tmpl

This file was deleted.

4 changes: 2 additions & 2 deletions mirc/cmd/templates/fiber-v2/go.mod.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ module {{ .PkgName }}
go 1.16

require (
github.com/alimy/mir/v2 v2.7.0-alpha
github.com/gofiber/fiber/v2 v2.3.3
github.com/alimy/mir/v2 {{ .VersionOfMir "v2.7.0" }}
github.com/gofiber/fiber/v2 {{ .VersionOfEngine "v2.3.3" }}
)
{{if notEmptyStr .MirPkgName }}
replace (
Expand Down
24 changes: 0 additions & 24 deletions mirc/cmd/templates/fiber-v2/go.sum.tmpl

This file was deleted.

4 changes: 2 additions & 2 deletions mirc/cmd/templates/fiber/go.mod.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ module {{ .PkgName }}
go 1.16

require (
github.com/alimy/mir/v2 v2.7.0-alpha
github.com/gofiber/fiber v1.14.6
github.com/alimy/mir/v2 {{ .VersionOfMir "v2.7.0" }}
github.com/gofiber/fiber {{ .VersionOfEngine "v1.14.6" }}
)
{{if notEmptyStr .MirPkgName }}
replace (
Expand Down
29 changes: 0 additions & 29 deletions mirc/cmd/templates/fiber/go.sum.tmpl

This file was deleted.

4 changes: 2 additions & 2 deletions mirc/cmd/templates/gin/go.mod.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ module {{ .PkgName }}
go 1.16

require (
github.com/alimy/mir/v2 v2.7.0-alpha
github.com/gin-gonic/gin v1.6.3
github.com/alimy/mir/v2 {{ .VersionOfMir "v2.7.0" }}
github.com/gin-gonic/gin {{ .VersionOfEngine "v1.6.3" }}
)
{{if notEmptyStr .MirPkgName }}
replace (
Expand Down
47 changes: 0 additions & 47 deletions mirc/cmd/templates/gin/go.sum.tmpl

This file was deleted.

4 changes: 2 additions & 2 deletions mirc/cmd/templates/httprouter/go.mod.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ module {{ .PkgName }}
go 1.16

require (
github.com/alimy/mir/v2 v2.7.0-alpha
github.com/julienschmidt/httprouter v1.3.0
github.com/alimy/mir/v2 {{ .VersionOfMir "v2.7.0" }}
github.com/julienschmidt/httprouter {{ .VersionOfEngine "v1.3.0" }}
)
{{if notEmptyStr .MirPkgName }}
replace (
Expand Down
2 changes: 0 additions & 2 deletions mirc/cmd/templates/httprouter/go.sum.tmpl

This file was deleted.

4 changes: 2 additions & 2 deletions mirc/cmd/templates/iris/go.mod.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ go 1.16

require (
github.com/ajg/form v1.5.1 // indirect
github.com/alimy/mir/v2 v2.7.0-alpha
github.com/alimy/mir/v2 {{ .VersionOfMir "v2.7.0" }}
github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072 // indirect
github.com/google/go-querystring v1.0.0 // indirect
github.com/imkira/go-interpol v1.1.0 // indirect
github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88 // indirect
github.com/kataras/iris/v12 v12.1.8
github.com/kataras/iris/v12 {{ .VersionOfEngine "v12.1.8" }}
github.com/mattn/go-colorable v0.1.8 // indirect
github.com/moul/http2curl v1.0.0 // indirect
github.com/onsi/ginkgo v1.14.2 // indirect
Expand Down
Loading

0 comments on commit 4a66f79

Please sign in to comment.