diff --git a/realize/projects.go b/realize/projects.go index 86bf259..97f3674 100644 --- a/realize/projects.go +++ b/realize/projects.go @@ -294,7 +294,7 @@ L: case fsnotify.Chmod: case fsnotify.Remove: p.watcher.Remove(event.Name) - if p.Validate(event.Name, false) { + if p.Validate(event.Name, false) && ext(event.Name) != "" { // stop and restart close(p.stop) p.stop = make(chan bool) @@ -320,7 +320,6 @@ L: p.lastTime = time.Now().Truncate(time.Second) p.lastFile = event.Name } - } } } @@ -349,10 +348,6 @@ func (p *Project) Validate(path string, fcheck bool) bool { if !array(e, p.Watcher.Exts) { return false } - }else{ - if !array(filepath.Base(path), p.Watcher.Paths) { - return false - } } separator := string(os.PathSeparator) // supported paths @@ -366,7 +361,7 @@ func (p *Project) Validate(path string, fcheck bool) bool { // file check if fcheck { fi, err := os.Stat(path) - if !fi.IsDir() && ext(path) == ""{ + if !fi.IsDir() && ext(path) == "" { return false } if err != nil { @@ -432,7 +427,7 @@ func (p *Project) tools(stop <-chan bool, path string, fi os.FileInfo) { return case r := <-result: if r.Err != nil { - if fi.IsDir(){ + if fi.IsDir() { path, _ = filepath.Abs(fi.Name()) } msg = fmt.Sprintln(p.pname(p.Name, 2), ":", Red.Bold(r.Name), Red.Regular("there are some errors in"), ":", Magenta.Bold(path)) @@ -577,7 +572,7 @@ func (p *Project) run(path string, stream chan Response, stop <-chan bool) (err name := filepath.Base(path) if path == "." && p.Tools.Run.Dir == "" { name = filepath.Base(Wdir()) - }else{ + } else { name = filepath.Base(dirPath) } path = filepath.Join(dirPath, name) diff --git a/realize/projects_test.go b/realize/projects_test.go index b4a3e22..b9d4669 100644 --- a/realize/projects_test.go +++ b/realize/projects_test.go @@ -130,7 +130,7 @@ func TestProject_Validate(t *testing.T) { }, }) for i, v := range data { - if r.Projects[0].Validate(i, true) != v { + if r.Projects[0].Validate(i, false) != v { t.Error("Unexpected error", i, "expected", v) } }