- Timestamp:
- Jun 17, 2024, 3:43:09 PM (16 months ago)
- Location:
- trunk
- Files:
-
- 2 edited
-
.gitignore (modified) (1 diff)
-
cmd/aya/buildall.go (modified) (1 diff)
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 lastModified := time.Unix(0, 0)16 modified := false15 lastModified := time.Unix(0, 0) 16 modified := false 17 17 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 directories23 if filepath.Base(path)[0] == '.' || strings.HasPrefix(path, ".") {24 return nil25 }26 // inform user about fs walk errors, but continue iteration27 if err != nil {28 fmt.Println("error:", err)29 return nil30 }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 if info.IsDir() {33 os.Mkdir(filepath.Join(PUBDIR, path), 0755)34 return nil35 } else if info.ModTime().After(lastModified) {36 if !modified {37 // First file in this build cycle is about to be modified38 run(vars, "prehook")39 modified = true40 }41 fmt.Println("GEN", path)42 return build(path, nil, vars)43 }44 return nil45 })46 if modified {47 // At least one file in this build cycle has been modified48 run(vars, "posthook")49 modified = false50 }51 if !watch {52 break53 }54 lastModified = time.Now()55 time.Sleep(1 * time.Second)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.
