Updates; instable

Former-commit-id: e3f4a16286e135cb643f36fc9518a760dca82333 [formerly ffd101f980b04f10bc4bc99e43bcc3ff962993a4] [formerly 15e574f9edbd1579a12424d51aa9926e0dbd84dd [formerly ae8e97a43ead8ee8485f1a8fbe3819e74cee6bbd]]
Former-commit-id: a2db52a130b73a1ac235630d87797edd0c38c756 [formerly bf85e68f90f75cad611b90545ce7415123de84bd]
Former-commit-id: f9915ecf27cc6c2456eb867a7d3a8beb29531e35
This commit is contained in:
Henrique Dias
2017-07-29 10:54:05 +01:00
parent 0d453229d9
commit 00be85db13
5 changed files with 212 additions and 168 deletions

View File

@@ -6,7 +6,6 @@ import (
"fmt"
"net/http"
"os"
"os/exec"
"path/filepath"
"strings"
@@ -123,26 +122,12 @@ func parse(c *caddy.Controller) ([]*filemanager.FileManager, error) {
}
// Try to find the Hugo executable path.
if hugo.Exe, err = exec.LookPath("hugo"); err != nil {
return nil, plugins.ErrHugoNotFound
}
err = m.RegisterPlugin("hugo", hugo)
if err != nil {
if err = hugo.Find(); err != nil {
return nil, err
}
err = m.RegisterEventType("before_publish")
if err != nil {
return nil, err
}
err = m.RegisterEventType("after_publish")
if err != nil {
return nil, err
}
err = m.RegisterPermission("allowPublish", true)
// Attaches Hugo plugin to this file manager instance.
err = m.ActivatePlugin("hugo", hugo)
if err != nil {
return nil, err
}