Permalink
Browse files

all: Unify case of config variable names

All config variables starts with low-case and uses camelCase.

If there is abbreviation at the beginning of the name, the whole
abbreviation will be written in low-case.
If there is abbreviation at the end of the name, the
whole abbreviation will be written in upper-case.
For example, rssURI.
  • Loading branch information...
1 parent d9f54a1 commit f21e2f25c99c547a2f35d209935f8f1c52fa2671 @bogem bogem committed with bep Oct 24, 2016
Showing with 469 additions and 469 deletions.
  1. +1 −1 commands/convert.go
  2. +53 −53 commands/hugo.go
  3. +3 −3 commands/import_jekyll.go
  4. +3 −3 commands/list.go
  5. +2 −2 commands/new.go
  6. +14 −14 commands/server.go
  7. +1 −1 commands/server_test.go
  8. +3 −3 create/content.go
  9. +1 −1 create/content_test.go
  10. +5 −7 docs/content/content/multilingual.md
  11. +1 −1 docs/content/extras/aliases.md
  12. +3 −3 docs/content/extras/menus.md
  13. +6 −6 docs/content/extras/urls.md
  14. +3 −3 docs/content/meta/release-notes.md
  15. +17 −17 docs/content/overview/configuration.md
  16. +1 −1 docs/content/overview/introduction.md
  17. +4 −4 docs/content/overview/quickstart.md
  18. +6 −6 docs/content/templates/content.md
  19. +2 −2 docs/content/templates/go-templates.md
  20. +1 −1 docs/content/templates/variables.md
  21. +14 −14 docs/content/tutorials/create-a-multilingual-site.md
  22. +3 −3 docs/content/tutorials/creating-a-new-theme.md
  23. +15 −15 docs/content/tutorials/github-pages-blog.md
  24. +1 −1 docs/content/tutorials/migrate-from-jekyll.md
  25. +2 −2 examples/blog/config.toml
  26. +2 −2 examples/multilingual/config.toml
  27. +1 −1 helpers/configProvider.go
  28. +4 −4 helpers/content.go
  29. +3 −3 helpers/content_renderer.go
  30. +3 −3 helpers/content_renderer_test.go
  31. +2 −2 helpers/language.go
  32. +3 −3 helpers/path.go
  33. +6 −6 helpers/path_test.go
  34. +11 −10 helpers/pygments.go
  35. +5 −5 helpers/pygments_test.go
  36. +2 −2 helpers/url.go
  37. +10 −10 helpers/url_test.go
  38. +1 −1 hugofs/fs.go
  39. +3 −2 hugofs/fs_test.go
  40. +53 −53 hugolib/config.go
  41. +1 −1 hugolib/config_test.go
  42. +3 −3 hugolib/embedded_shortcodes_test.go
  43. +1 −1 hugolib/handler_page.go
  44. +1 −1 hugolib/handler_test.go
  45. +3 −3 hugolib/hugo_sites.go
  46. +23 −23 hugolib/hugo_sites_test.go
  47. +9 −9 hugolib/menu_test.go
  48. +9 −9 hugolib/page.go
  49. +3 −3 hugolib/page_permalink_test.go
  50. +4 −4 hugolib/page_test.go
  51. +1 −1 hugolib/pagination_test.go
  52. +2 −2 hugolib/robotstxt_test.go
  53. +2 −2 hugolib/rss_test.go
  54. +8 −8 hugolib/shortcode_test.go
  55. +55 −55 hugolib/site.go
  56. +4 −4 hugolib/site_show_plan_test.go
  57. +41 −41 hugolib/site_test.go
  58. +2 −2 hugolib/site_url_test.go
  59. +1 −1 hugolib/sitemap_test.go
  60. +1 −1 source/file.go
  61. +1 −1 source/filesystem.go
  62. +1 −1 tpl/template_funcs.go
  63. +5 −5 tpl/template_funcs_test.go
  64. +3 −3 tpl/template_i18n.go
  65. +3 −3 tpl/template_i18n_test.go
  66. +5 −5 tpl/template_resources.go
  67. +3 −3 tpl/template_resources_test.go
View
@@ -134,7 +134,7 @@ func convertContents(mark rune) (err error) {
metadata = newmetadata
}
- page.SetDir(filepath.Join(helpers.AbsPathify(viper.GetString("ContentDir")), file.Dir()))
+ page.SetDir(filepath.Join(helpers.AbsPathify(viper.GetString("contentDir")), file.Dir()))
page.SetSourceContent(psr.Content())
if err = page.SetSourceMetaData(metadata, mark); err != nil {
jww.ERROR.Printf("Failed to set source metadata for file %q: %s. For more info see For more info see https://github.com/spf13/hugo/issues/2458", page.FullFilePath(), err)
View
@@ -117,7 +117,7 @@ Complete documentation is available at http://gohugo.io/.`,
}
if buildWatch {
- viper.Set("DisableLiveReload", true)
+ viper.Set("disableLiveReload", true)
watchConfig()
}
@@ -284,55 +284,55 @@ func InitializeConfig(subCmdVs ...*cobra.Command) error {
for _, cmdV := range append([]*cobra.Command{hugoCmdV}, subCmdVs...) {
if flagChanged(cmdV.PersistentFlags(), "verbose") {
- viper.Set("Verbose", verbose)
+ viper.Set("verbose", verbose)
}
if flagChanged(cmdV.PersistentFlags(), "logFile") {
- viper.Set("LogFile", logFile)
+ viper.Set("logFile", logFile)
}
if flagChanged(cmdV.Flags(), "cleanDestinationDir") {
viper.Set("cleanDestinationDir", cleanDestination)
}
if flagChanged(cmdV.Flags(), "buildDrafts") {
- viper.Set("BuildDrafts", draft)
+ viper.Set("buildDrafts", draft)
}
if flagChanged(cmdV.Flags(), "buildFuture") {
- viper.Set("BuildFuture", future)
+ viper.Set("buildFuture", future)
}
if flagChanged(cmdV.Flags(), "buildExpired") {
- viper.Set("BuildExpired", expired)
+ viper.Set("buildExpired", expired)
}
if flagChanged(cmdV.Flags(), "uglyURLs") {
- viper.Set("UglyURLs", uglyURLs)
+ viper.Set("uglyURLs", uglyURLs)
}
if flagChanged(cmdV.Flags(), "canonifyURLs") {
- viper.Set("CanonifyURLs", canonifyURLs)
+ viper.Set("canonifyURLs", canonifyURLs)
}
if flagChanged(cmdV.Flags(), "disable404") {
- viper.Set("Disable404", disable404)
+ viper.Set("disable404", disable404)
}
if flagChanged(cmdV.Flags(), "disableRSS") {
- viper.Set("DisableRSS", disableRSS)
+ viper.Set("disableRSS", disableRSS)
}
if flagChanged(cmdV.Flags(), "disableSitemap") {
- viper.Set("DisableSitemap", disableSitemap)
+ viper.Set("disableSitemap", disableSitemap)
}
if flagChanged(cmdV.Flags(), "enableRobotsTXT") {
- viper.Set("EnableRobotsTXT", enableRobotsTXT)
+ viper.Set("enableRobotsTXT", enableRobotsTXT)
}
if flagChanged(cmdV.Flags(), "pluralizeListTitles") {
- viper.Set("PluralizeListTitles", pluralizeListTitles)
+ viper.Set("pluralizeListTitles", pluralizeListTitles)
}
if flagChanged(cmdV.Flags(), "preserveTaxonomyNames") {
- viper.Set("PreserveTaxonomyNames", preserveTaxonomyNames)
+ viper.Set("preserveTaxonomyNames", preserveTaxonomyNames)
}
if flagChanged(cmdV.Flags(), "ignoreCache") {
- viper.Set("IgnoreCache", ignoreCache)
+ viper.Set("ignoreCache", ignoreCache)
}
if flagChanged(cmdV.Flags(), "forceSyncStatic") {
- viper.Set("ForceSyncStatic", forceSync)
+ viper.Set("forceSyncStatic", forceSync)
}
if flagChanged(cmdV.Flags(), "noTimes") {
- viper.Set("NoTimes", noTimes)
+ viper.Set("noTimes", noTimes)
}
}
@@ -341,10 +341,10 @@ func InitializeConfig(subCmdVs ...*cobra.Command) error {
if !strings.HasSuffix(baseURL, "/") {
baseURL = baseURL + "/"
}
- viper.Set("BaseURL", baseURL)
+ viper.Set("baseURL", baseURL)
}
- if !viper.GetBool("RelativeURLs") && viper.GetString("BaseURL") == "" {
+ if !viper.GetBool("relativeURLs") && viper.GetString("baseURL") == "" {
jww.ERROR.Println("No 'baseurl' set in configuration or as a flag. Features like page menus will not work without one.")
}
@@ -353,27 +353,27 @@ func InitializeConfig(subCmdVs ...*cobra.Command) error {
}
if destination != "" {
- viper.Set("PublishDir", destination)
+ viper.Set("publishDir", destination)
}
+ var dir string
if source != "" {
- dir, _ := filepath.Abs(source)
- viper.Set("WorkingDir", dir)
+ dir, _ = filepath.Abs(source)
} else {
- dir, _ := os.Getwd()
- viper.Set("WorkingDir", dir)
+ dir, _ = os.Getwd()
}
+ viper.Set("workingDir", dir)
if contentDir != "" {
- viper.Set("ContentDir", contentDir)
+ viper.Set("contentDir", contentDir)
}
if layoutDir != "" {
- viper.Set("LayoutDir", layoutDir)
+ viper.Set("layoutDir", layoutDir)
}
if cacheDir != "" {
- viper.Set("CacheDir", cacheDir)
+ viper.Set("cacheDir", cacheDir)
}
cacheDir = viper.GetString("cacheDir")
@@ -386,14 +386,14 @@ func InitializeConfig(subCmdVs ...*cobra.Command) error {
if isDir == false {
mkdir(cacheDir)
}
- viper.Set("CacheDir", cacheDir)
+ viper.Set("cacheDir", cacheDir)
} else {
- viper.Set("CacheDir", helpers.GetTempDir("hugo_cache", hugofs.Source()))
+ viper.Set("cacheDir", helpers.GetTempDir("hugo_cache", hugofs.Source()))
}
- if verboseLog || logging || (viper.IsSet("LogFile") && viper.GetString("LogFile") != "") {
- if viper.IsSet("LogFile") && viper.GetString("LogFile") != "" {
- jww.SetLogFile(viper.GetString("LogFile"))
+ if verboseLog || logging || (viper.IsSet("logFile") && viper.GetString("logFile") != "") {
+ if viper.IsSet("logFile") && viper.GetString("logFile") != "" {
+ jww.SetLogFile(viper.GetString("logFile"))
} else {
jww.UseTempLogFile("hugo")
}
@@ -448,7 +448,7 @@ func watchConfig() {
fmt.Println("Config file changed:", e.Name)
// Force a full rebuild
utils.CheckErr(reCreateAndbuildSites(true))
- if !viper.GetBool("DisableLiveReload") {
+ if !viper.GetBool("disableLiveReload") {
// Will block forever trying to write to a channel that nobody is reading if livereload isn't initialized
livereload.ForceRefresh()
}
@@ -463,11 +463,11 @@ func build(watches ...bool) error {
if renderToMemory {
hugofs.SetDestination(new(afero.MemMapFs))
// Rendering to memoryFS, publish to Root regardless of publishDir.
- viper.Set("PublishDir", "/")
+ viper.Set("publishDir", "/")
}
if err := copyStatic(); err != nil {
- return fmt.Errorf("Error copying static files to %s: %s", helpers.AbsPathify(viper.GetString("PublishDir")), err)
+ return fmt.Errorf("Error copying static files to %s: %s", helpers.AbsPathify(viper.GetString("publishDir")), err)
}
watch := false
if len(watches) > 0 && watches[0] {
@@ -478,7 +478,7 @@ func build(watches ...bool) error {
}
if buildWatch {
- jww.FEEDBACK.Println("Watching for changes in", helpers.AbsPathify(viper.GetString("ContentDir")))
+ jww.FEEDBACK.Println("Watching for changes in", helpers.AbsPathify(viper.GetString("contentDir")))
jww.FEEDBACK.Println("Press Ctrl+C to stop")
utils.CheckErr(NewWatcher(0))
}
@@ -532,7 +532,7 @@ func getStaticSourceFs() afero.Fs {
}
func copyStatic() error {
- publishDir := helpers.AbsPathify(viper.GetString("PublishDir")) + helpers.FilePathSeparator
+ publishDir := helpers.AbsPathify(viper.GetString("publishDir")) + helpers.FilePathSeparator
// If root, remove the second '/'
if publishDir == "//" {
@@ -567,10 +567,10 @@ func copyStatic() error {
// getDirList provides NewWatcher() with a list of directories to watch for changes.
func getDirList() []string {
var a []string
- dataDir := helpers.AbsPathify(viper.GetString("DataDir"))
- i18nDir := helpers.AbsPathify(viper.GetString("I18nDir"))
- layoutDir := helpers.AbsPathify(viper.GetString("LayoutDir"))
- staticDir := helpers.AbsPathify(viper.GetString("StaticDir"))
+ dataDir := helpers.AbsPathify(viper.GetString("dataDir"))
+ i18nDir := helpers.AbsPathify(viper.GetString("i18nDir"))
+ layoutDir := helpers.AbsPathify(viper.GetString("layoutDir"))
+ staticDir := helpers.AbsPathify(viper.GetString("staticDir"))
var themesDir string
if helpers.ThemeSet() {
@@ -580,22 +580,22 @@ func getDirList() []string {
walker := func(path string, fi os.FileInfo, err error) error {
if err != nil {
if path == dataDir && os.IsNotExist(err) {
- jww.WARN.Println("Skip DataDir:", err)
+ jww.WARN.Println("Skip dataDir:", err)
return nil
}
if path == i18nDir && os.IsNotExist(err) {
- jww.WARN.Println("Skip I18nDir:", err)
+ jww.WARN.Println("Skip i18nDir:", err)
return nil
}
if path == layoutDir && os.IsNotExist(err) {
- jww.WARN.Println("Skip LayoutDir:", err)
+ jww.WARN.Println("Skip layoutDir:", err)
return nil
}
if path == staticDir && os.IsNotExist(err) {
- jww.WARN.Println("Skip StaticDir:", err)
+ jww.WARN.Println("Skip staticDir:", err)
return nil
}
@@ -636,9 +636,9 @@ func getDirList() []string {
}
helpers.SymbolicWalk(hugofs.Source(), dataDir, walker)
- helpers.SymbolicWalk(hugofs.Source(), helpers.AbsPathify(viper.GetString("ContentDir")), walker)
+ helpers.SymbolicWalk(hugofs.Source(), helpers.AbsPathify(viper.GetString("contentDir")), walker)
helpers.SymbolicWalk(hugofs.Source(), i18nDir, walker)
- helpers.SymbolicWalk(hugofs.Source(), helpers.AbsPathify(viper.GetString("LayoutDir")), walker)
+ helpers.SymbolicWalk(hugofs.Source(), helpers.AbsPathify(viper.GetString("layoutDir")), walker)
helpers.SymbolicWalk(hugofs.Source(), staticDir, walker)
if helpers.ThemeSet() {
@@ -801,7 +801,7 @@ func NewWatcher(port int) error {
}
if len(staticEvents) > 0 {
- publishDir := helpers.AbsPathify(viper.GetString("PublishDir")) + helpers.FilePathSeparator
+ publishDir := helpers.AbsPathify(viper.GetString("publishDir")) + helpers.FilePathSeparator
// If root, remove the second '/'
if publishDir == "//" {
@@ -812,11 +812,11 @@ func NewWatcher(port int) error {
const layout = "2006-01-02 15:04 -0700"
fmt.Println(time.Now().Format(layout))
- if viper.GetBool("ForceSyncStatic") {
+ if viper.GetBool("forceSyncStatic") {
jww.FEEDBACK.Printf("Syncing all static files\n")
err := copyStatic()
if err != nil {
- utils.StopOnErr(err, fmt.Sprintf("Error copying static files to %s", helpers.AbsPathify(viper.GetString("PublishDir"))))
+ utils.StopOnErr(err, fmt.Sprintf("Error copying static files to %s", helpers.AbsPathify(viper.GetString("publishDir"))))
}
} else {
staticSourceFs := getStaticSourceFs()
@@ -896,7 +896,7 @@ func NewWatcher(port int) error {
}
}
- if !buildWatch && !viper.GetBool("DisableLiveReload") {
+ if !buildWatch && !viper.GetBool("disableLiveReload") {
// Will block forever trying to write to a channel that nobody is reading if livereload isn't initialized
// force refresh when more than one file
@@ -919,7 +919,7 @@ func NewWatcher(port int) error {
rebuildSites(dynamicEvents)
- if !buildWatch && !viper.GetBool("DisableLiveReload") {
+ if !buildWatch && !viper.GetBool("disableLiveReload") {
// Will block forever trying to write to a channel that nobody is reading if livereload isn't initialized
livereload.ForceRefresh()
}
@@ -933,7 +933,7 @@ func NewWatcher(port int) error {
}()
if port > 0 {
- if !viper.GetBool("DisableLiveReload") {
+ if !viper.GetBool("disableLiveReload") {
livereload.Initialize()
http.HandleFunc("/livereload.js", livereload.ServeJS)
http.HandleFunc("/livereload", livereload.Handler)
@@ -221,7 +221,7 @@ func loadJekyllConfig(jekyllRoot string) map[string]interface{} {
func createConfigFromJekyll(inpath string, kind string, jekyllConfig map[string]interface{}) (err error) {
title := "My New Hugo Site"
- baseurl := "http://example.org/"
+ baseURL := "http://example.org/"
for key, value := range jekyllConfig {
lowerKey := strings.ToLower(key)
@@ -234,13 +234,13 @@ func createConfigFromJekyll(inpath string, kind string, jekyllConfig map[string]
case "url":
if str, ok := value.(string); ok {
- baseurl = str
+ baseURL = str
}
}
}
in := map[string]interface{}{
- "baseurl": baseurl,
+ "baseURL": baseURL,
"title": title,
"languageCode": "en-us",
"disablePathToLower": true,
View
@@ -49,7 +49,7 @@ var listDraftsCmd = &cobra.Command{
return err
}
- viper.Set("BuildDrafts", true)
+ viper.Set("buildDrafts", true)
sites, err := hugolib.NewHugoSitesFromConfiguration()
@@ -84,7 +84,7 @@ posted in the future.`,
return err
}
- viper.Set("BuildFuture", true)
+ viper.Set("buildFuture", true)
sites, err := hugolib.NewHugoSitesFromConfiguration()
@@ -119,7 +119,7 @@ expired.`,
return err
}
- viper.Set("BuildExpired", true)
+ viper.Set("buildExpired", true)
sites, err := hugolib.NewHugoSitesFromConfiguration()
View
@@ -89,11 +89,11 @@ func NewContent(cmd *cobra.Command, args []string) error {
}
if flagChanged(cmd.Flags(), "format") {
- viper.Set("MetaDataFormat", configFormat)
+ viper.Set("metaDataFormat", configFormat)
}
if flagChanged(cmd.Flags(), "editor") {
- viper.Set("NewContentEditor", contentEditor)
+ viper.Set("newContentEditor", contentEditor)
}
if len(args) < 1 {
Oops, something went wrong.

0 comments on commit f21e2f2

Please sign in to comment.