all: Refactor to nonglobal Viper, i18n etc.

This is a final rewrite that removes all the global state in Hugo, which also enables
the use if `t.Parallel` in tests.

Updates #2701
Fixes #3016
This commit is contained in:
Bjørn Erik Pedersen
2017-02-05 10:20:06 +07:00
parent e34af6ee30
commit 93ca7c9e95
99 changed files with 2843 additions and 2458 deletions

View File

@@ -32,7 +32,6 @@ import (
bp "github.com/spf13/hugo/bufferpool"
jww "github.com/spf13/jwalterweatherman"
"github.com/spf13/pflag"
"github.com/spf13/viper"
)
// FilePathSeparator as defined by os.Separator.
@@ -196,8 +195,8 @@ func ReaderContains(r io.Reader, subslice []byte) bool {
}
// ThemeSet checks whether a theme is in use or not.
func ThemeSet() bool {
return viper.GetString("theme") != ""
func (p *PathSpec) ThemeSet() bool {
return p.theme != ""
}
type logPrinter interface {