Revel tool enhancements

* run Command will choose CWD if no additional arguments are supplied
* Added Revel version check, compatible lists are in model/version
This commit is contained in:
NotZippy
2018-10-10 20:53:23 -07:00
parent 031fde6009
commit 8c21a56302
8 changed files with 236 additions and 35 deletions

View File

@@ -119,6 +119,8 @@ func newApp(c *model.CommandConfig) (err error) {
if err = setApplicationPath(c); err != nil {
return err
}
// At this point the versions can be set
c.SetVersions()
// checking and setting skeleton
if err=setSkeletonPath(c);err!=nil {
@@ -189,16 +191,6 @@ func setApplicationPath(c *model.CommandConfig) (err error) {
c.AppName = filepath.Base(c.AppPath)
//if c.BasePath == "." {
// // we need to remove the a single '.' when
// // the app is in the $GOROOT/src directory
// c.BasePath = ""
//} else {
// // we need to append a '/' when the app is
// // is a subdirectory such as $GOROOT/src/path/to/revelapp
// c.BasePath += "/"
//}
return nil
}

View File

@@ -12,6 +12,7 @@ import (
"github.com/revel/cmd/model"
"github.com/revel/cmd/utils"
"go/build"
"os"
)
var cmdRun = &Command{
@@ -108,7 +109,8 @@ func updateRunConfig(c *model.CommandConfig, args []string) bool {
c.Run.Mode = args[0]
}
case 0:
return false
// Attempt to set the import path to the current working director.
c.Run.ImportPath,_ = os.Getwd()
}
c.Index = model.RUN
return true

View File

@@ -118,3 +118,4 @@ func versionApp(c *model.CommandConfig) (err error) {
return
}