commands: Include theme name in version mismatch error
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Tue, 14 Aug 2018 19:21:39 +0000 (21:21 +0200)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Tue, 14 Aug 2018 19:21:39 +0000 (21:21 +0200)
Fixes #5044

commands/commandeer.go
commands/hugo.go

index 3ff0b6426978e4e4877bd3e253093ae90f5a8444..0a024f04759cd049971bb7fed2ecbd0fa2fa436f 100644 (file)
@@ -17,6 +17,7 @@ import (
        "os"
        "path/filepath"
        "regexp"
+       "strings"
        "sync"
        "time"
 
@@ -324,11 +325,12 @@ func (c *commandeer) loadConfig(mustHaveConfigFile, running bool) error {
                }
        }
 
-       themeVersionMismatch, minVersion := c.isThemeVsHugoVersionMismatch(sourceFs)
+       dir, themeVersionMismatch, minVersion := c.isThemeVsHugoVersionMismatch(sourceFs)
 
        if themeVersionMismatch {
-               cfg.Logger.ERROR.Printf("Current theme does not support Hugo version %s. Minimum version required is %s\n",
-                       helpers.CurrentHugoVersion.ReleaseVersion(), minVersion)
+               name := filepath.Base(dir)
+               cfg.Logger.ERROR.Printf("%s theme does not support Hugo version %s. Minimum version required is %s\n",
+                       strings.ToUpper(name), helpers.CurrentHugoVersion.ReleaseVersion(), minVersion)
        }
 
        return nil
index 1381bf2100ac0adcddee9b20a73cd7f546d53dba..c80080c49eafe781e4cf35f2f758aed95b03b703 100644 (file)
@@ -945,7 +945,7 @@ func pickOneWriteOrCreatePath(events []fsnotify.Event) string {
 
 // isThemeVsHugoVersionMismatch returns whether the current Hugo version is
 // less than any of the themes' min_version.
-func (c *commandeer) isThemeVsHugoVersionMismatch(fs afero.Fs) (mismatch bool, requiredMinVersion string) {
+func (c *commandeer) isThemeVsHugoVersionMismatch(fs afero.Fs) (dir string, mismatch bool, requiredMinVersion string) {
        if !c.hugo.PathSpec.ThemeSet() {
                return
        }
@@ -970,7 +970,7 @@ func (c *commandeer) isThemeVsHugoVersionMismatch(fs afero.Fs) (mismatch bool, r
 
                if minVersion, ok := tomlMeta["min_version"]; ok {
                        if helpers.CompareVersion(minVersion) > 0 {
-                               return true, fmt.Sprint(minVersion)
+                               return absThemeDir, true, fmt.Sprint(minVersion)
                        }
                }