octopress / ink

A core component for building Gem based Jekyll themes.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Deprecations when calling methods on 'posts' in Jekyll 3.4.3

dgmstuart opened this issue · comments

Deprecation: posts.empty? should be changed to posts.docs.empty?.
                    Called by /usr/local/var/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/octopress-ink-1.2.1/lib/octopress-ink/plugin/bootstrap.rb:163:in `posts?'.

https://github.com/octopress/ink/blob/master/lib/octopress-ink/plugin/bootstrap.rb#L163

Deprecation: posts.select should be changed to posts.docs.select.
                    Called by /usr/local/var/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/octopress-ink-1.2.1/lib/octopress-ink/plugin/bootstrap.rb:171:in `linkposts?'.

https://github.com/octopress/ink/blob/master/lib/octopress-ink/plugin/bootstrap.rb#L171

I don't super understand the Jekyll code, but this deprecation was introduced when moving from 2.x to 3.x. It seems like there will be a breaking change at some point such that these (enumerable-ish? collection-ish?) methods will no longer be defined on whatever pages returns, but instead on pages.docs.

Should be a straightforward fix - I'll have a look.

Looks like this will also be a problem in multilingual, e.g. https://github.com/octopress/multilingual/blob/master/lib/octopress-multilingual.rb#L130
https://github.com/octopress/multilingual/blob/master/lib/octopress-multilingual.rb#L152

Loads of array-ish operations on posts in that file.

Issue on Multilingual - possibly related: octopress/multilingual#29

Looking at the code I'm not super confident making a change without some support:

  • I'm not sure how to run the tests - a note in the readme on that would be great.
  • There are lines like Octopress.site.pages << page - are they fine, or do they need to use .docs as well?
  • This would be a breaking change, so how should this be handled? Perhaps making a version 1.2.2 which is locked to jekyll < 3, and then a version 2.0 for jekyll >= 3.0.0?

Oops - looks like there's already a PR for this: #66