Changeset 88 in code
- Timestamp:
- Jun 17, 2024, 3:43:09 PM (12 months ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/.gitignore
r85 r88 2 2 *.bak 3 3 **.pub 4 *.sw* 4 5 5 6 /aya -
trunk/cmd/aya/buildall.go
r84 r88 13 13 14 14 func buildAll(watch bool) { 15 16 15 lastModified := time.Unix(0, 0) 16 modified := false 17 17 18 19 20 21 22 23 24 25 26 27 28 29 30 18 vars := globals() 19 for { 20 os.Mkdir(PUBDIR, 0755) 21 filepath.Walk(".", func(path string, info os.FileInfo, err error) error { 22 // ignore hidden files and directories 23 if filepath.Base(path)[0] == '.' || strings.HasPrefix(path, ".") { 24 return nil 25 } 26 // inform user about fs walk errors, but continue iteration 27 if err != nil { 28 fmt.Println("error:", err) 29 return nil 30 } 31 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 32 if info.IsDir() { 33 os.Mkdir(filepath.Join(PUBDIR, path), 0755) 34 return nil 35 } else if info.ModTime().After(lastModified) { 36 if !modified { 37 // First file in this build cycle is about to be modified 38 run(vars, "prehook") 39 modified = true 40 } 41 fmt.Println("GEN", path) 42 return build(path, nil, vars) 43 } 44 return nil 45 }) 46 if modified { 47 // At least one file in this build cycle has been modified 48 run(vars, "posthook") 49 modified = false 50 } 51 if !watch { 52 break 53 } 54 lastModified = time.Now() 55 time.Sleep(1 * time.Second) 56 } 57 57 }
Note:
See TracChangeset
for help on using the changeset viewer.