Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2016-07-26 00:26:15 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2016-09-06 18:32:16 +0300
commitc447b7dd6efcb662f177ad0c9037133361ed74e3 (patch)
tree30b51126bb467de39d20e68791fcc83fe03db0bd /commands
parentc4e7c37055a029a26d87ebeb21614efb3f0b0040 (diff)
Rename MainSites to Sites
Having many *main* sites doesn't make much sense.
Diffstat (limited to 'commands')
-rw-r--r--commands/benchmark.go4
-rw-r--r--commands/hugo.go20
2 files changed, 12 insertions, 12 deletions
diff --git a/commands/benchmark.go b/commands/benchmark.go
index 53d2c8e9e..53e11c3f6 100644
--- a/commands/benchmark.go
+++ b/commands/benchmark.go
@@ -57,7 +57,7 @@ func benchmark(cmd *cobra.Command, args []string) error {
return err
}
for i := 0; i < benchmarkTimes; i++ {
- MainSites = nil
+ Sites = nil
_ = buildSite()
}
pprof.WriteHeapProfile(f)
@@ -76,7 +76,7 @@ func benchmark(cmd *cobra.Command, args []string) error {
pprof.StartCPUProfile(f)
defer pprof.StopCPUProfile()
for i := 0; i < benchmarkTimes; i++ {
- MainSites = nil
+ Sites = nil
_ = buildSite()
}
}
diff --git a/commands/hugo.go b/commands/hugo.go
index c773ac5c4..4fd4dcb9d 100644
--- a/commands/hugo.go
+++ b/commands/hugo.go
@@ -46,10 +46,10 @@ import (
"github.com/spf13/viper"
)
-// MainSites represents the Hugo sites to build. This variable is exported as it
+// Sites represents the Hugo sites to build. This variable is exported as it
// is used by at least one external library (the Hugo caddy plugin). We should
// provide a cleaner external API, but until then, this is it.
-var MainSites map[string]*hugolib.Site
+var Sites map[string]*hugolib.Site
// Reset resets Hugo ready for a new full build. This is mainly only useful
// for benchmark testing etc. via the CLI commands.
@@ -510,7 +510,7 @@ func watchConfig() {
viper.OnConfigChange(func(e fsnotify.Event) {
fmt.Println("Config file changed:", e.Name)
// Force a full rebuild
- MainSites = nil
+ Sites = nil
utils.CheckErr(buildSite(true))
if !viper.GetBool("DisableLiveReload") {
// Will block forever trying to write to a channel that nobody is reading if livereload isn't initialized
@@ -708,16 +708,16 @@ func buildSite(watching ...bool) (err error) {
fmt.Println("Started building site")
t0 := time.Now()
- if MainSites == nil {
- MainSites = make(map[string]*hugolib.Site)
+ if Sites == nil {
+ Sites = make(map[string]*hugolib.Site)
}
for _, lang := range langConfigsList {
t1 := time.Now()
- mainSite, present := MainSites[lang.Lang]
+ mainSite, present := Sites[lang.Lang]
if !present {
mainSite = new(hugolib.Site)
- MainSites[lang.Lang] = mainSite
+ Sites[lang.Lang] = mainSite
mainSite.SetMultilingualConfig(lang, langConfigsList)
}
@@ -742,13 +742,13 @@ func rebuildSite(events []fsnotify.Event) error {
for _, lang := range langConfigsList {
t1 := time.Now()
- mainSite := MainSites[lang.Lang]
+ site := Sites[lang.Lang]
- if err := mainSite.ReBuild(events); err != nil {
+ if err := site.ReBuild(events); err != nil {
return err
}
- mainSite.Stats(lang.Lang, t1)
+ site.Stats(lang.Lang, t1)
}
jww.FEEDBACK.Printf("total in %v ms\n", int(1000*time.Since(t0).Seconds()))