Skip to content

Commit

Permalink
Remove and update deprecation status
Browse files Browse the repository at this point in the history
  • Loading branch information
bep committed Jan 25, 2018
1 parent b2fcbb1 commit d418c2c
Show file tree
Hide file tree
Showing 11 changed files with 2 additions and 90 deletions.
19 changes: 0 additions & 19 deletions commands/hugo.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,6 @@ func initHugoBuildCommonFlags(cmd *cobra.Command) {
cmd.Flags().BoolP("buildDrafts", "D", false, "include content marked as draft")
cmd.Flags().BoolP("buildFuture", "F", false, "include content with publishdate in the future")
cmd.Flags().BoolP("buildExpired", "E", false, "include expired content")
cmd.Flags().Bool("disable404", false, "do not render 404 page")
cmd.Flags().Bool("disableRSS", false, "do not build RSS files")
cmd.Flags().Bool("disableSitemap", false, "do not build Sitemap file")
cmd.Flags().StringVarP(&source, "source", "s", "", "filesystem path to read files relative from")
cmd.Flags().StringVarP(&contentDir, "contentDir", "c", "", "filesystem path to content directory")
cmd.Flags().StringVarP(&layoutDir, "layoutDir", "l", "", "filesystem path to layout directory")
Expand Down Expand Up @@ -491,9 +488,6 @@ func (c *commandeer) initializeFlags(cmd *cobra.Command) {
"buildExpired",
"uglyURLs",
"canonifyURLs",
"disable404",
"disableRSS",
"disableSitemap",
"enableRobotsTXT",
"enableGitInfo",
"pluralizeListTitles",
Expand All @@ -506,19 +500,6 @@ func (c *commandeer) initializeFlags(cmd *cobra.Command) {
"templateMetricsHints",
}

// Remove these in Hugo 0.33.
if cmd.Flags().Changed("disable404") {
helpers.Deprecated("command line", "--disable404", "Use --disableKinds=404", true)
}

if cmd.Flags().Changed("disableRSS") {
helpers.Deprecated("command line", "--disableRSS", "Use --disableKinds=RSS", true)
}

if cmd.Flags().Changed("disableSitemap") {
helpers.Deprecated("command line", "--disableSitemap", "Use --disableKinds=sitemap", true)
}

for _, key := range persFlagKeys {
c.setValueFromFlag(cmd.PersistentFlags(), key)
}
Expand Down
21 changes: 0 additions & 21 deletions hugolib/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,23 +64,6 @@ func LoadConfig(fs afero.Fs, relativeSourcePath, configFilename string) (*viper.

v.RegisterAlias("indexes", "taxonomies")

// Remove these in Hugo 0.33.
if v.IsSet("disable404") {
helpers.Deprecated("site config", "disable404", "Use disableKinds=[\"404\"]", true)
}

if v.IsSet("disableRSS") {
helpers.Deprecated("site config", "disableRSS", "Use disableKinds=[\"RSS\"]", true)
}

if v.IsSet("disableSitemap") {
helpers.Deprecated("site config", "disableSitemap", "Use disableKinds= [\"sitemap\"]", true)
}

if v.IsSet("disableRobotsTXT") {
helpers.Deprecated("site config", "disableRobotsTXT", "Use disableKinds= [\"robotsTXT\"]", true)
}

if err := loadDefaultSettingsFor(v); err != nil {
return v, err
}
Expand Down Expand Up @@ -183,10 +166,6 @@ func loadDefaultSettingsFor(v *viper.Viper) error {
v.SetDefault("cleanDestinationDir", false)
v.SetDefault("watch", false)
v.SetDefault("metaDataFormat", "toml")
v.SetDefault("disable404", false)
v.SetDefault("disableRSS", false)
v.SetDefault("disableSitemap", false)
v.SetDefault("disableRobotsTXT", false)
v.SetDefault("contentDir", "content")
v.SetDefault("layoutDir", "layouts")
v.SetDefault("staticDir", "static")
Expand Down
4 changes: 0 additions & 4 deletions hugolib/hugo_sites.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,10 +331,6 @@ func (h *HugoSites) renderCrossSitesArtifacts() error {
return nil
}

if h.Cfg.GetBool("disableSitemap") {
return nil
}

sitemapEnabled := false
for _, s := range h.Sites {
if s.isEnabled(kindSitemap) {
Expand Down
6 changes: 0 additions & 6 deletions hugolib/hugo_sites_build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -855,8 +855,6 @@ var tocPageWithShortcodesInHeadingsExpected = `<nav id="TableOfContents">

var multiSiteTOMLConfigTemplate = `
baseURL = "http://example.com/blog"
disableSitemap = false
disableRSS = false
rssURI = "index.xml"
paginate = 1
Expand Down Expand Up @@ -915,8 +913,6 @@ lag = "lag"

var multiSiteYAMLConfigTemplate = `
baseURL: "http://example.com/blog"
disableSitemap: false
disableRSS: false
rssURI: "index.xml"
disablePathToLower: true
Expand Down Expand Up @@ -976,8 +972,6 @@ Languages:
var multiSiteJSONConfigTemplate = `
{
"baseURL": "http://example.com/blog",
"disableSitemap": false,
"disableRSS": false,
"rssURI": "index.xml",
"paginate": 1,
"disablePathToLower": true,
Expand Down
12 changes: 0 additions & 12 deletions hugolib/page.go
Original file line number Diff line number Diff line change
Expand Up @@ -881,12 +881,6 @@ func (p *Page) analyzePage() {
})
}

func (p *Page) Extension() string {
// Remove in Hugo 0.22.
helpers.Deprecated("Page", "Extension", "See OutputFormats with its MediaType", true)
return p.extension
}

// HasShortcode return whether the page has a shortcode with the given name.
// This method is mainly motivated with the Hugo Docs site's need for a list
// of pages with the `todo` shortcode in it.
Expand Down Expand Up @@ -1849,12 +1843,6 @@ func (p *Page) copy() *Page {
return &c
}

func (p *Page) Now() time.Time {
// Delete in Hugo 0.22
helpers.Deprecated("Page", "Now", "Use now (the template func)", true)
return time.Now()
}

func (p *Page) Hugo() *HugoInfo {
return hugoInfo
}
Expand Down
6 changes: 0 additions & 6 deletions hugolib/page_paths.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,3 @@ func (p *Page) createRelativeTargetPathForOutputFormat(f output.Format) string {

return tp
}

func (p *Page) TargetPath() (outfile string) {
// Delete in Hugo 0.22
helpers.Deprecated("Page", "TargetPath", "This method does not make sanse any more.", true)
return ""
}
1 change: 0 additions & 1 deletion hugolib/page_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1483,7 +1483,6 @@ func TestIndexPageSimpleMethods(t *testing.T) {
{func(n *Page) bool { return !n.IsPage() }},
{func(n *Page) bool { return n.Scratch() != nil }},
{func(n *Page) bool { return n.Hugo() != nil }},
{func(n *Page) bool { return n.Now().Unix() == time.Now().Unix() }},
} {

n := s.newHomePage()
Expand Down
5 changes: 0 additions & 5 deletions hugolib/site.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,11 +371,6 @@ type SiteInfo struct {
sectionPagesMenu string
}

func (s *SiteInfo) Files() []source.File {
helpers.Deprecated(".Site", "Files", "", true)
return nil
}

func (s *SiteInfo) String() string {
return fmt.Sprintf("Site(%q)", s.Title)
}
Expand Down
4 changes: 2 additions & 2 deletions hugolib/site_output.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ func createDefaultOutputFormats(allFormats output.Formats, cfg config.Provider)
if rssBase == "" || rssBase == "index.xml" {
rssBase = rssOut.BaseName
} else {
// Remove in Hugo 0.22.
helpers.Deprecated("Site config", "rssURI", "Set baseName in outputFormats.RSS", false)
// Remove in Hugo 0.36.
helpers.Deprecated("Site config", "rssURI", "Set baseName in outputFormats.RSS", true)
// RSS has now a well defined media type, so strip any suffix provided
rssBase = strings.TrimSuffix(rssBase, path.Ext(rssBase))
}
Expand Down
12 changes: 0 additions & 12 deletions hugolib/site_render.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,6 @@ func (s *Site) renderRSS(p *PageOutput) error {
return nil
}

if s.Cfg.GetBool("disableRSS") {
return nil
}

p.Kind = kindRSS

limit := s.Cfg.GetInt("rssLimit")
Expand Down Expand Up @@ -283,10 +279,6 @@ func (s *Site) render404() error {
return nil
}

if s.Cfg.GetBool("disable404") {
return nil
}

p := s.newNodePage(kind404)

p.title = "404 Page not found"
Expand Down Expand Up @@ -321,10 +313,6 @@ func (s *Site) renderSitemap() error {
return nil
}

if s.Cfg.GetBool("disableSitemap") {
return nil
}

sitemapDefault := parseSitemap(s.Cfg.GetStringMap("sitemap"))

n := s.newNodePage(kindSitemap)
Expand Down
2 changes: 0 additions & 2 deletions hugolib/site_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,6 @@ func doTestShouldAlwaysHaveUglyURLs(t *testing.T, uglyURLs bool) {

cfg.Set("verbose", true)
cfg.Set("baseURL", "http://auth/bub")
cfg.Set("disableSitemap", false)
cfg.Set("disableRSS", false)
cfg.Set("rssURI", "index.xml")
cfg.Set("blackfriday",
map[string]interface{}{
Expand Down

0 comments on commit d418c2c

Please sign in to comment.