1
0
mirror of https://github.com/astaxie/beego.git synced 2025-07-16 02:22:15 +00:00

refact beego config

This commit is contained in:
astaxie
2015-12-09 23:35:04 +08:00
parent 3d4ad560f8
commit d1bba02958
21 changed files with 485 additions and 831 deletions

View File

@@ -130,7 +130,7 @@ func parserComments(comments *ast.CommentGroup, funcName, controllerName, pkgpat
}
func genRouterCode() {
os.Mkdir(path.Join(workPath, "routers"), 0755)
os.Mkdir("routers", 0755)
Info("generate router from comments")
var (
globalinfo string
@@ -172,7 +172,7 @@ func genRouterCode() {
}
}
if globalinfo != "" {
f, err := os.Create(path.Join(workPath, "routers", commentFilename))
f, err := os.Create(path.Join("routers", commentFilename))
if err != nil {
panic(err)
}
@@ -182,11 +182,11 @@ func genRouterCode() {
}
func compareFile(pkgRealpath string) bool {
if !utils.FileExists(path.Join(workPath, "routers", commentFilename)) {
if !utils.FileExists(path.Join("routers", commentFilename)) {
return true
}
if utils.FileExists(path.Join(workPath, lastupdateFilename)) {
content, err := ioutil.ReadFile(path.Join(workPath, lastupdateFilename))
if utils.FileExists(lastupdateFilename) {
content, err := ioutil.ReadFile(lastupdateFilename)
if err != nil {
return true
}
@@ -214,7 +214,7 @@ func savetoFile(pkgRealpath string) {
if err != nil {
return
}
ioutil.WriteFile(path.Join(workPath, lastupdateFilename), d, os.ModePerm)
ioutil.WriteFile(lastupdateFilename, d, os.ModePerm)
}
func getpathTime(pkgRealpath string) (lastupdate int64, err error) {