all: Propagate baseURL error to the callers

This commit is contained in:
Bjørn Erik Pedersen 2017-03-25 14:37:04 +01:00
parent 148fedd227
commit 15b64d51da
18 changed files with 124 additions and 47 deletions

View file

@ -16,6 +16,7 @@ package commands
import (
"github.com/spf13/hugo/deps"
"github.com/spf13/hugo/helpers"
"github.com/spf13/hugo/hugofs"
)
type commandeer struct {
@ -35,12 +36,14 @@ func (c *commandeer) Set(key string, value interface{}) {
// be configured before it is created.
func (c *commandeer) PathSpec() *helpers.PathSpec {
c.configured = true
if c.pathSpec == nil {
c.pathSpec = helpers.NewPathSpec(c.Fs, c.Cfg)
}
return c.pathSpec
}
func newCommandeer(cfg *deps.DepsCfg) *commandeer {
return &commandeer{DepsCfg: cfg}
func newCommandeer(cfg *deps.DepsCfg) (*commandeer, error) {
fs := hugofs.NewDefault(cfg.Language)
ps, err := helpers.NewPathSpec(fs, cfg.Cfg)
if err != nil {
return nil, err
}
return &commandeer{DepsCfg: cfg, pathSpec: ps}, nil
}