octopress / ink

A core component for building Gem based Jekyll themes.
MIT License
103 stars 36 forks source link

Deprecations when calling methods on 'posts' in Jekyll 3.4.3 #67

Open dgmstuart opened 7 years ago

dgmstuart commented 7 years ago
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.

dgmstuart commented 7 years ago

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: https://github.com/octopress/multilingual/issues/29

dgmstuart commented 7 years ago

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

dgmstuart commented 7 years ago

Oops - looks like there's already a PR for this: https://github.com/octopress/ink/pull/66