diff --git a/.travis.yml b/.travis.yml index 907e2d1..530a051 100644 --- a/.travis.yml +++ b/.travis.yml @@ -55,15 +55,17 @@ script: - revel package --gomod-flags "edit -replace=github.com/revel/revel=github.com/revel/revel@$REVEL_BRANCH" -a my/testapp2 -v - revel package --gomod-flags "edit -replace=github.com/revel/revel=github.com/revel/revel@$REVEL_BRANCH" -a my/testapp2 -v -m prod + - export INITIALWD=$PWD # Check build works with no-vendor flag - cd $GOPATH - export GO111MODULE=auto - revel new -a my/testapp2 --no-vendor -v - revel test -a my/testapp2 -v - # Check non verbose build - - revel new --gomod-flags "edit -replace=github.com/revel/revel=github.com/revel/revel@$REVEL_BRANCH" -a my/testapp2 --package revelframework.com - - revel test --gomod-flags "edit -replace=github.com/revel/revel=github.com/revel/revel@$REVEL_BRANCH" -a my/testapp2 + # Check non verbose build, outside of GO path + - cd $INITIALWD + - revel new --gomod-flags "edit -replace=github.com/revel/revel=github.com/revel/revel@$REVEL_BRANCH" -a my/testapp3 --package revelframework.com + - revel test --gomod-flags "edit -replace=github.com/revel/revel=github.com/revel/revel@$REVEL_BRANCH" -a my/testapp3 matrix: allow_failures: diff --git a/model/command_config.go b/model/command_config.go index 41a055b..717a061 100644 --- a/model/command_config.go +++ b/model/command_config.go @@ -235,8 +235,8 @@ func (c *CommandConfig) InitPackageResolver() { c.PackageResolver = func(pkgName string) error { utils.Logger.Info("Request for package ", "package", pkgName, "use vendor", c.Vendored) var getCmd *exec.Cmd + print("Downloading related packages ...") if c.Vendored { - println("Downloading related packages") getCmd = exec.Command(c.GoCmd, "mod", "tidy") } else { utils.Logger.Info("No vendor folder detected, not using dependency manager to import package", "package", pkgName) @@ -246,10 +246,10 @@ func (c *CommandConfig) InitPackageResolver() { utils.CmdInit(getCmd, !c.Vendored, c.AppPath) utils.Logger.Info("Go get command ", "exec", getCmd.Path, "dir", getCmd.Dir, "args", getCmd.Args, "env", getCmd.Env, "package", pkgName) output, err := getCmd.CombinedOutput() - println("Downloading related packages completed") if err != nil { utils.Logger.Error("Failed to import package", "error", err, "gopath", build.Default.GOPATH, "GO-ROOT", build.Default.GOROOT, "output", string(output)) } + println(" completed.") return nil } diff --git a/revel/new.go b/revel/new.go index f8cf922..21fe5b2 100644 --- a/revel/new.go +++ b/revel/new.go @@ -72,7 +72,7 @@ func newApp(c *model.CommandConfig) (err error) { // Check for an existing folder so we don't clobber it _, err = build.Import(c.ImportPath, "", build.FindOnly) if err == nil || !utils.Empty(c.AppPath) { - return utils.NewBuildError("Abort: Import path already exists.", "path", c.ImportPath) + return utils.NewBuildError("Abort: Import path already exists.", "path", c.ImportPath, "apppath", c.AppPath) } // checking and setting skeleton @@ -112,6 +112,10 @@ func newApp(c *model.CommandConfig) (err error) { fmt.Fprintln(os.Stdout, "Your application has been created in:\n ", c.AppPath) // Check to see if it should be run right off if c.New.Run { + // Need to prep the run command + c.Run.ImportPath = c.ImportPath + updateRunConfig(c,nil) + c.UpdateImportPath() runApp(c) } else { fmt.Fprintln(os.Stdout, "\nYou can run it with:\n revel run -a ", c.ImportPath) diff --git a/revel/version_test.go b/revel/version_test.go index 4762721..ad13685 100644 --- a/revel/version_test.go +++ b/revel/version_test.go @@ -34,8 +34,8 @@ func TestVersion(t *testing.T) { a.Nil(main.Commands[model.VERSION].RunWith(c), "Failed to run version-test") }) if !t.Failed() { - if err := os.RemoveAll(gopath); err != nil { - a.Fail("Failed to remove test path") + if err := os.RemoveAll(gopath); err != nil && err!=os.ErrNotExist { + a.Fail("Failed to remove test path",err.Error()) } } } diff --git a/utils/file.go b/utils/file.go index 0aafb70..92a2cfd 100644 --- a/utils/file.go +++ b/utils/file.go @@ -309,9 +309,13 @@ func Exists(filename string) bool { // empty returns true if the given directory is empty. // the directory must exist. func Empty(dirname string) bool { + if !DirExists(dirname) { + return true + } dir, err := os.Open(dirname) if err != nil { Logger.Infof("error opening directory: %s", err) + return false } defer func() { _ = dir.Close()