Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ package main
import (
"flag"
"fmt"
"github.com/pilu/fresh/runner"
"os"

"github.com/pilu/fresh/runner"
)

func main() {
Expand Down
5 changes: 5 additions & 0 deletions runner/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const (
var settings = map[string]string{
"config_path": "./runner.conf",
"root": ".",
"subfolder": "",
"tmp_path": "./tmp",
"build_name": "runner-build",
"build_log": "runner-build-errors.log",
Expand Down Expand Up @@ -116,6 +117,10 @@ func tmpPath() string {
return settings["tmp_path"]
}

func subfolder() []string {
return strings.Split(settings["subfolder"], ",")
}

func buildName() string {
return settings["build_name"]
}
Expand Down
26 changes: 26 additions & 0 deletions runner/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,30 @@ func watch() {

return err
})

subfolders := subfolder()
for _, subfolder := range subfolders {
if len(subfolder) == 0 {
continue
}
filepath.Walk(strings.TrimSpace(subfolder), func(path string, info os.FileInfo, err error) error {
if info == nil {
return err
}
if info.IsDir() && !isTmpDir(path) {
if len(path) > 1 && strings.HasPrefix(filepath.Base(path), ".") {
return filepath.SkipDir
}

if isIgnoredFolder(path) {
watcherLog("Ignoring %s", path)
return filepath.SkipDir
}

watchFolder(path)
}

return err
})
}
}