1
0
mirror of https://github.com/beego/bee.git synced 2024-11-22 05:00:54 +00:00

Add support for watch main package files through bee.json

This commit is contained in:
Unknown 2013-07-24 20:36:22 +08:00
parent 172bc44b22
commit ead4f9fd81
3 changed files with 10 additions and 2 deletions

View File

@ -1,5 +1,9 @@
{ {
"dir_structure":{ "dir_structure":{
"controllers": "routers" "controllers": "",
} "models": ""
},
"files": [
"main.go"
]
} }

2
run.go
View File

@ -40,6 +40,7 @@ var conf struct {
Controllers string Controllers string
Models string Models string
} `json:"dir_structure"` } `json:"dir_structure"`
Files []string
} }
func runApp(cmd *Command, args []string) { func runApp(cmd *Command, args []string) {
@ -58,6 +59,7 @@ func runApp(cmd *Command, args []string) {
paths = append(paths, paths = append(paths,
path.Join(crupath, conf.DirStruct.Controllers), path.Join(crupath, conf.DirStruct.Controllers),
path.Join(crupath, conf.DirStruct.Models)) path.Join(crupath, conf.DirStruct.Models))
paths = append(paths, conf.Files...)
NewWatcher(paths) NewWatcher(paths)
appname = args[0] appname = args[0]

View File

@ -53,6 +53,8 @@ func NewWatcher(paths []string) {
} }
} }
}() }()
fmt.Println("[INFO] Initializing watcher...")
for _, path := range paths { for _, path := range paths {
fmt.Println(path) fmt.Println(path)
err = watcher.Watch(path) err = watcher.Watch(path)