mirror of
https://github.com/kevin-DL/revel-cmd.git
synced 2026-01-23 23:41:23 +00:00
More linting
This commit is contained in:
22
revel/new.go
22
revel/new.go
@@ -18,6 +18,8 @@ import (
|
||||
"github.com/revel/cmd/utils"
|
||||
)
|
||||
|
||||
const ErrNoSkeleton Error = "failed to find skeleton in filepath"
|
||||
|
||||
var cmdNew = &Command{
|
||||
UsageLine: "new -i [path] -s [skeleton]",
|
||||
Short: "create a skeleton Revel application",
|
||||
@@ -92,7 +94,9 @@ func newApp(c *model.CommandConfig) (err error) {
|
||||
// This kicked off the download of the revel app, not needed for vendor
|
||||
if !c.Vendored {
|
||||
// At this point the versions can be set
|
||||
c.SetVersions()
|
||||
if err = c.SetVersions(); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// copy files to new app directory
|
||||
@@ -114,11 +118,18 @@ func newApp(c *model.CommandConfig) (err error) {
|
||||
// Need to prep the run command
|
||||
c.Run.ImportPath = c.ImportPath
|
||||
updateRunConfig(c, nil)
|
||||
c.UpdateImportPath()
|
||||
runApp(c)
|
||||
|
||||
if err = c.UpdateImportPath(); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = runApp(c); err != nil {
|
||||
return
|
||||
}
|
||||
} else {
|
||||
fmt.Fprintln(os.Stdout, "\nYou can run it with:\n revel run -a ", c.ImportPath)
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
@@ -129,13 +140,16 @@ func createModVendor(c *model.CommandConfig) (err error) {
|
||||
utils.CmdInit(goModCmd, !c.Vendored, c.AppPath)
|
||||
|
||||
utils.Logger.Info("Exec:", "args", goModCmd.Args, "env", goModCmd.Env, "workingdir", goModCmd.Dir)
|
||||
|
||||
getOutput, err := goModCmd.CombinedOutput()
|
||||
if c.New.Callback != nil {
|
||||
err = c.New.Callback()
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return utils.NewBuildIfError(err, string(getOutput))
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
@@ -206,7 +220,7 @@ func setSkeletonPath(c *model.CommandConfig) (err error) {
|
||||
c.New.SkeletonPath = fullpath
|
||||
utils.Logger.Info("Set skeleton path to ", fullpath)
|
||||
if !utils.DirExists(fullpath) {
|
||||
return fmt.Errorf("failed to find skeleton in filepath %s %s", fullpath, sp.String())
|
||||
return fmt.Errorf("%w %s %s", ErrNoSkeleton, fullpath, sp.String())
|
||||
}
|
||||
case "git":
|
||||
fallthrough
|
||||
|
||||
Reference in New Issue
Block a user