1
0
mirror of https://github.com/beego/bee.git synced 2025-07-04 21:50:18 +00:00

#323: Removes the check if the current path is a Beego project

This commit is contained in:
Faissal Elamraoui
2016-11-21 15:23:08 +01:00
parent ac935ad4e0
commit e39dc9fb7f
4 changed files with 7 additions and 14 deletions

11
util.go
View File

@ -17,7 +17,6 @@ package main
import (
"fmt"
"io/ioutil"
"log"
"os"
"os/exec"
"path"
@ -67,7 +66,8 @@ func GetGOPATHs() []string {
return paths
}
func isBeegoProject(thePath string) bool {
// IsBeegoProject checks whether the current path is a Beego application or not
func IsBeegoProject(thePath string) bool {
mainFiles := []string{}
hasBeegoRegex := regexp.MustCompile(`(?s)package main.*?import.*?\(.*?github.com/astaxie/beego".*?\).*func main()`)
// Walk the application path tree to look for main files.
@ -86,7 +86,7 @@ func isBeegoProject(thePath string) bool {
})
if err != nil {
log.Fatalf("Unable to walk '%s' tree: %v", thePath, err)
logger.Fatalf("Unable to walk '%s' tree: %v", thePath, err)
return false
}
@ -116,9 +116,6 @@ func SearchGOPATHs(app string) (bool, string, string) {
}
if isExist(currentPath) {
if !isBeegoProject(currentPath) {
continue
}
return true, gopath, currentPath
}
}
@ -134,7 +131,7 @@ func askForConfirmation() bool {
var response string
_, err := fmt.Scanln(&response)
if err != nil {
log.Fatal(err)
logger.Fatalf("%s", err)
}
okayResponses := []string{"y", "Y", "yes", "Yes", "YES"}
nokayResponses := []string{"n", "N", "no", "No", "NO"}