diff --git a/dir.go b/dir.go index 6d45581..de1a820 100644 --- a/dir.go +++ b/dir.go @@ -47,12 +47,12 @@ func NewDir(path string) *Dir { } } -// Read reads from a directory and indexes the files and directories within it. -func (d *Dir) Read(srcDir string, task *Task) error { - return d.read(srcDir, "", task) +// read reads from a directory and indexes the files and directories within it. +func (d *Dir) read(srcDir string, task *Task) error { + return d._read(srcDir, "", task) } -func (d *Dir) read(srcDir, path string, task *Task) error { +func (d *Dir) _read(srcDir, path string, task *Task) error { entries, err := ioutil.ReadDir(pathpkg.Join(srcDir, path)) if err != nil { return err @@ -67,7 +67,7 @@ func (d *Dir) read(srcDir, path string, task *Task) error { if entry.IsDir() { // Gather directory data dir := NewDir(path) - if err := dir.read(srcDir, path, task); err != nil { + if err := dir._read(srcDir, path, task); err != nil { return err } d.Dirs = append(d.Dirs, dir) @@ -140,8 +140,8 @@ func (d *Dir) read(srcDir, path string, task *Task) error { return nil } -// Process processes the directory's contents. -func (d *Dir) Process(cfg *Config, task *Task) error { +// process processes the directory's contents. +func (d *Dir) process(cfg *Config, task *Task) error { if task.TemplateExt != "" { // Create index if d.index != nil { @@ -198,15 +198,15 @@ func (d *Dir) Process(cfg *Config, task *Task) error { // Process subdirectories for _, d := range d.Dirs { - if err := d.Process(cfg, task); err != nil { + if err := d.process(cfg, task); err != nil { return err } } return nil } -// Write writes the directory's contents to the provided destination path. -func (d *Dir) Write(dstDir string, task *Task) error { +// write writes the directory's contents to the provided destination path. +func (d *Dir) write(dstDir string, task *Task) error { // Create the directory dirPath := pathpkg.Join(dstDir, d.Path) if err := os.MkdirAll(dirPath, 0755); err != nil { @@ -250,7 +250,7 @@ func (d *Dir) Write(dstDir string, task *Task) error { // Write subdirectories for _, dir := range d.Dirs { - dir.Write(dstDir, task) + dir.write(dstDir, task) } return nil } diff --git a/main.go b/main.go index 4dbc565..cd1f5a6 100644 --- a/main.go +++ b/main.go @@ -83,16 +83,16 @@ func run(cfg *Config) error { func runTask(cfg *Config, task *Task) error { // Read content dir := NewDir("") - if err := dir.Read("content", task); err != nil { + if err := dir.read("content", task); err != nil { return err } dir.sort() // Process content - if err := dir.Process(cfg, task); err != nil { + if err := dir.process(cfg, task); err != nil { return err } // Write content - if err := dir.Write(task.OutputDir, task); err != nil { + if err := dir.write(task.OutputDir, task); err != nil { return err } // Copy static files