mirror of
https://github.com/beego/bee.git
synced 2024-11-26 16:41:30 +00:00
Removed redundant beego project check
This commit is contained in:
parent
5bc1c82a2b
commit
828b8d8b53
17
run.go
17
run.go
@ -15,12 +15,12 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
path "path/filepath"
|
path "path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
"fmt"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var cmdRun = &Command{
|
var cmdRun = &Command{
|
||||||
@ -70,16 +70,16 @@ func runApp(cmd *Command, args []string) int {
|
|||||||
if len(args) == 0 || args[0] == "watchall" {
|
if len(args) == 0 || args[0] == "watchall" {
|
||||||
currpath, _ = os.Getwd()
|
currpath, _ = os.Getwd()
|
||||||
|
|
||||||
if !isBeegoProject(currpath) {
|
if found, _gopath, _ := SearchGOPATHs(currpath); found {
|
||||||
|
appname = path.Base(currpath)
|
||||||
|
currentGoPath = _gopath
|
||||||
|
} else {
|
||||||
exitPrint(fmt.Sprintf("Bee does not support non Beego project: %s", currpath))
|
exitPrint(fmt.Sprintf("Bee does not support non Beego project: %s", currpath))
|
||||||
}
|
}
|
||||||
|
ColorLog("[INFO] Using '%s' as 'appname'\n", appname)
|
||||||
_, currentGoPath, _ = SearchGOPATHs(currpath)
|
|
||||||
appname = path.Base(currpath)
|
|
||||||
ColorLog("[INFO] Uses '%s' as 'appname'\n", appname)
|
|
||||||
} else {
|
} else {
|
||||||
// Check if passed Bee application path/name exists in the GOPATH(s)
|
// Check if passed Bee application path/name exists in the GOPATH(s)
|
||||||
if ok, _gopath, _path := SearchGOPATHs(args[0]); ok {
|
if found, _gopath, _path := SearchGOPATHs(args[0]); found {
|
||||||
currpath = _path
|
currpath = _path
|
||||||
currentGoPath = _gopath
|
currentGoPath = _gopath
|
||||||
appname = path.Base(currpath)
|
appname = path.Base(currpath)
|
||||||
@ -87,7 +87,8 @@ func runApp(cmd *Command, args []string) int {
|
|||||||
panic(fmt.Sprintf("No Beego application '%s' found in your GOPATH", args[0]))
|
panic(fmt.Sprintf("No Beego application '%s' found in your GOPATH", args[0]))
|
||||||
}
|
}
|
||||||
|
|
||||||
ColorLog("[INFO] Uses '%s' as 'appname'\n", appname)
|
ColorLog("[INFO] Using '%s' as 'appname'\n", appname)
|
||||||
|
|
||||||
if strings.HasSuffix(appname, ".go") && isExist(currpath) {
|
if strings.HasSuffix(appname, ".go") && isExist(currpath) {
|
||||||
ColorLog("[WARN] The appname is in conflict with currpath's file, do you want to build appname as %s\n", appname)
|
ColorLog("[WARN] The appname is in conflict with currpath's file, do you want to build appname as %s\n", appname)
|
||||||
ColorLog("[INFO] Do you want to overwrite it? [yes|no]] ")
|
ColorLog("[INFO] Do you want to overwrite it? [yes|no]] ")
|
||||||
|
Loading…
Reference in New Issue
Block a user