This commit is contained in:
Henrique Dias committed 2016-06-21 15:28:15 +01:00
1 parent 8879f22932
commit b43d8e2465
67 files changed
+977 -3381

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
package hugo
import (
"log"
"os"
"github.com/hacdias/caddy-hugo/tools/commands"
"github.com/hacdias/caddy-hugo/tools/variables"
)
// Run is used to run the static website generator
func Run(c *Config, force bool) {
os.RemoveAll(c.Path + "public")
// Prevent running if watching is enabled
if b, pos := variables.StringInSlice("--watch", c.Args); b && !force {
if len(c.Args) > pos && c.Args[pos+1] != "false" {
return
}
if len(c.Args) == pos+1 {
return
}
}
if err := commands.Run(c.Hugo, c.Args, c.Path); err != nil {
log.Panic(err)
}
}