Skip to content

Commit

Permalink
cleanup todos
Browse files Browse the repository at this point in the history
  • Loading branch information
mna committed Jul 14, 2013
1 parent aedc084 commit bfdc95f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
7 changes: 2 additions & 5 deletions gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ import (
"github.com/eknkc/amber"
)

// TODO : All fatal errors should be non-stopping errors when generating the site. Allows
// for corrections of the code, then re-triggering the generation.

var (
postTpl *template.Template
postTplNm = "post.amber"
Expand Down Expand Up @@ -116,7 +113,7 @@ func generateSite() error {
}

func generateRss(td *TemplateData) error {
r := NewRss(td.SiteName, "", Options.BaseURL)
r := NewRss(td.SiteName, td.TagLine, Options.BaseURL)
base, err := url.Parse(Options.BaseURL)
if err != nil {
return fmt.Errorf("error parsing base URL: %s", err)
Expand All @@ -140,7 +137,7 @@ func generateFile(td *TemplateData, idx bool) error {
}
defer fw.Close()

// If this is the newer file, also save as index.html
// If this is the newest file, also save as index.html
w = fw
if idx {
idxw, err := os.Create(filepath.Join(PublicDir, "index.html"))
Expand Down
8 changes: 4 additions & 4 deletions watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ func watch(w *fsnotify.Watcher) {
var delay <-chan time.Time
for {
select {
case ev := <-w.Event:
log.Println("watch event ", ev)
case <-w.Event:
// Regenerate the files after the delay, reset the delay if an event is triggered
// in the meantime
delay = time.After(watchEventDelay)
Expand All @@ -51,9 +50,10 @@ func watch(w *fsnotify.Watcher) {
log.Println("WATCH ERROR ", err)

case <-delay:
log.Print("trigger generation of site")
if err := generateSite(); err != nil {
log.Println("ERROR ", err)
log.Println("ERROR generating site: ", err)
} else {
log.Println("site generated")
}
}
}
Expand Down

0 comments on commit bfdc95f

Please sign in to comment.