mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
parent
b3cb6788b2
commit
1c97095ac0
4 changed files with 52 additions and 14 deletions
|
@ -244,6 +244,10 @@ func (c *Config) CompileConfig(logger loggers.Logger) error {
|
|||
// Legacy config.
|
||||
kind = "taxonomy"
|
||||
}
|
||||
if kinds.GetKindAny(kind) == "" {
|
||||
logger.Warnf("Unknown kind %q in disableKinds", kind)
|
||||
continue
|
||||
}
|
||||
disabledKinds[kind] = true
|
||||
}
|
||||
kindOutputFormats := make(map[string]output.Formats)
|
||||
|
|
|
@ -1611,3 +1611,30 @@ List.
|
|||
b.AssertDestinationExists("categories/index.html", false)
|
||||
|
||||
}
|
||||
|
||||
func TestDisableKindsUnknown(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
files := `
|
||||
-- hugo.toml --
|
||||
disableKinds = ['foo', 'home']
|
||||
-- layouts/_default/list.html --
|
||||
List.
|
||||
|
||||
|
||||
|
||||
`
|
||||
b := NewIntegrationTestBuilder(
|
||||
IntegrationTestConfig{
|
||||
T: t,
|
||||
TxtarString: files,
|
||||
LogLevel: logg.LevelWarn,
|
||||
BuildCfg: BuildCfg{SkipRender: true},
|
||||
},
|
||||
).Init()
|
||||
|
||||
fmt.Println("LOG:", b.LogString())
|
||||
|
||||
b.AssertLogContains("WARN Unknown kind \"foo\" in disableKinds\n")
|
||||
|
||||
}
|
||||
|
|
|
@ -228,6 +228,14 @@ func (s *IntegrationTestBuilder) BuildE() (*IntegrationTestBuilder, error) {
|
|||
return s, err
|
||||
}
|
||||
|
||||
func (s *IntegrationTestBuilder) Init() *IntegrationTestBuilder {
|
||||
if err := s.initBuilder(); err != nil {
|
||||
s.Fatalf("Failed to init builder: %s", err)
|
||||
}
|
||||
return s
|
||||
|
||||
}
|
||||
|
||||
type IntegrationTestDebugConfig struct {
|
||||
Out io.Writer
|
||||
|
||||
|
@ -356,12 +364,23 @@ func (s *IntegrationTestBuilder) initBuilder() error {
|
|||
flags.Set("workingDir", s.Cfg.WorkingDir)
|
||||
}
|
||||
|
||||
w := &s.logBuff
|
||||
|
||||
logger := loggers.New(
|
||||
loggers.Options{
|
||||
Stdout: w,
|
||||
Stderr: w,
|
||||
Level: s.Cfg.LogLevel,
|
||||
Distinct: true,
|
||||
},
|
||||
)
|
||||
|
||||
res, err := allconfig.LoadConfig(
|
||||
allconfig.ConfigSourceDescriptor{
|
||||
Flags: flags,
|
||||
ConfigDir: configDir,
|
||||
Fs: afs,
|
||||
Logger: loggers.NewDefault(),
|
||||
Logger: logger,
|
||||
Environ: s.Cfg.Environ,
|
||||
},
|
||||
)
|
||||
|
@ -375,7 +394,7 @@ func (s *IntegrationTestBuilder) initBuilder() error {
|
|||
|
||||
s.Assert(err, qt.IsNil)
|
||||
|
||||
depsCfg := deps.DepsCfg{Configs: res, Fs: fs, LogLevel: s.Cfg.LogLevel, LogOut: &s.logBuff}
|
||||
depsCfg := deps.DepsCfg{Configs: res, Fs: fs, LogLevel: logger.Level(), LogOut: logger.Out()}
|
||||
sites, err := NewHugoSites(depsCfg)
|
||||
if err != nil {
|
||||
initErr = err
|
||||
|
|
|
@ -93,15 +93,3 @@ func GetKindAny(s string) string {
|
|||
}
|
||||
return kindMapTemporary[strings.ToLower(s)]
|
||||
}
|
||||
|
||||
// IsDeprecated returns whether the given kind is deprecated.
|
||||
func IsDeprecated(s string) bool {
|
||||
s = strings.ToLower(s)
|
||||
|
||||
switch s {
|
||||
case "taxonomyterm":
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue