Hugo Updates

Former-commit-id: 35d71feaf1921d3b965331e02ac45274a24e1d5f [formerly 98ad98d2326fee3f4dc318f0597f53688704ecfe] [formerly 0d02b487fd32a169a4f1133e086058f1db3df108 [formerly b863033d7ab83ba3db1dff74f0b3b5e1a9a39300]]
Former-commit-id: 3fc286e691e56c3ff03b0e50ea89adf586a86789 [formerly 2b4bbc4ce6bab8c69c9baa3653480221a1ff71d2]
Former-commit-id: 83d23b6b60d00b6499729e145074396c7ffbc06d
This commit is contained in:
Henrique Dias
2017-07-29 10:14:34 +01:00
parent 4a4db4f4ee
commit 0d453229d9
6 changed files with 32 additions and 69 deletions

View File

@@ -3,7 +3,6 @@ package hugo
import (
"crypto/md5"
"encoding/hex"
"errors"
"fmt"
"net/http"
"os"
@@ -12,16 +11,12 @@ import (
"strings"
"github.com/hacdias/filemanager"
"github.com/hacdias/filemanager/plugins"
"github.com/hacdias/fileutils"
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddyhttp/httpserver"
)
var (
errHugoNotFound = errors.New("It seems that tou don't have 'hugo' on your PATH")
errUnsupportedFileType = errors.New("The type of the provided file isn't supported for this action")
)
// setup configures a new FileManager middleware instance.
func setup(c *caddy.Controller) error {
configs, err := parse(c)
@@ -120,7 +115,7 @@ func parse(c *caddy.Controller) ([]*filemanager.FileManager, error) {
}
// Initialize the default settings for Hugo.
hugo := &hugo{
hugo := &plugins.Hugo{
Root: directory,
Public: filepath.Join(directory, "public"),
Args: []string{},
@@ -129,7 +124,7 @@ 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, errHugoNotFound
return nil, plugins.ErrHugoNotFound
}
err = m.RegisterPlugin("hugo", hugo)