mirror of
https://github.com/beego/bee.git
synced 2025-07-05 18:20:18 +00:00
bee default support watchall support generate doc
bee run appname true
This commit is contained in:
14
watch.go
14
watch.go
@ -34,7 +34,7 @@ var (
|
||||
buildPeriod time.Time
|
||||
)
|
||||
|
||||
func NewWatcher(paths []string, files []string) {
|
||||
func NewWatcher(paths []string, files []string, isgenerate bool) {
|
||||
watcher, err := fsnotify.NewWatcher()
|
||||
if err != nil {
|
||||
ColorLog("[ERRO] Fail to create new Watcher[ %s ]\n", err)
|
||||
@ -71,7 +71,7 @@ func NewWatcher(paths []string, files []string) {
|
||||
|
||||
if isbuild {
|
||||
ColorLog("[EVEN] %s\n", e)
|
||||
go Autobuild(files)
|
||||
go Autobuild(files, isgenerate)
|
||||
}
|
||||
case err := <-watcher.Error:
|
||||
ColorLog("[WARN] %s\n", err.Error()) // No need to exit here
|
||||
@ -110,7 +110,7 @@ func getFileModTime(path string) int64 {
|
||||
return fi.ModTime().Unix()
|
||||
}
|
||||
|
||||
func Autobuild(files []string) {
|
||||
func Autobuild(files []string, isgenerate bool) {
|
||||
state.Lock()
|
||||
defer state.Unlock()
|
||||
|
||||
@ -148,6 +148,14 @@ func Autobuild(files []string) {
|
||||
}
|
||||
}
|
||||
|
||||
if isgenerate {
|
||||
icmd := exec.Command("bee", "generate", "docs")
|
||||
icmd.Stdout = os.Stdout
|
||||
icmd.Stderr = os.Stderr
|
||||
icmd.Run()
|
||||
ColorLog("============== generate docs ===================\n")
|
||||
}
|
||||
|
||||
if err == nil {
|
||||
appName := appname
|
||||
if runtime.GOOS == "windows" {
|
||||
|
Reference in New Issue
Block a user