This commit is contained in:
lealife
2017-11-30 20:15:28 +08:00
parent bba9030f14
commit 6cbb82a927
34 changed files with 51 additions and 126 deletions

10
cmd/leanote_revel/new.go Executable file → Normal file
View File

@ -8,7 +8,6 @@ import (
"bytes"
"fmt"
"go/build"
"log"
"math/rand"
"os"
"os/exec"
@ -67,8 +66,6 @@ func newApp(args []string) {
errorf("Too many arguments provided.\nRun 'revel help new' for usage.\n")
}
revel.ERROR.SetFlags(log.LstdFlags)
// checking and setting go paths
initGoPaths()
@ -129,7 +126,7 @@ func initGoPaths() {
}
if len(srcRoot) == 0 {
revel.ERROR.Fatalln("Abort: could not create a Revel application outside of GOPATH.")
revel.RevelLog.Fatal("Abort: could not create a Revel application outside of GOPATH.")
}
// set go src path
@ -148,8 +145,10 @@ func setApplicationPath(args []string) {
importPath)
}
appPath = filepath.Join(srcRoot, filepath.FromSlash(importPath))
_, err = build.Import(importPath, "", build.FindOnly)
if err == nil {
if err == nil && !empty(appPath) {
errorf("Abort: Import path %s already exists.\n", importPath)
}
@ -158,7 +157,6 @@ func setApplicationPath(args []string) {
errorf("Abort: Could not find Revel source code: %s\n", err)
}
appPath = filepath.Join(srcRoot, filepath.FromSlash(importPath))
appName = filepath.Base(appPath)
basePath = filepath.ToSlash(filepath.Dir(importPath))