Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport #7948 for v4.0.x #8124

Merged
merged 2 commits into from Apr 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .rubocop.yml
Expand Up @@ -107,6 +107,8 @@ Style/Alias:
EnforcedStyle: prefer_alias_method
Style/AndOr:
Severity: error
Style/BracesAroundHashParameters:
Enabled: false
Style/ClassAndModuleChildren:
Exclude:
- test/**/*.rb
Expand Down
10 changes: 6 additions & 4 deletions .travis.yml
Expand Up @@ -4,9 +4,11 @@ cache: bundler
language: ruby

rvm:
- &ruby1 2.6.3
- &ruby2 2.4.6
- &jruby jruby-9.2.7.0
- &ruby1 2.7.1
- &ruby2 2.6.6
- &ruby3 2.5.8
- &ruby4 2.4.10
- &jruby jruby-9.2.11.1

matrix:
include:
Expand All @@ -19,7 +21,7 @@ matrix:
- rvm: *ruby1
env: TEST_SUITE=profile-docs
name: "Profile Docs"
- rvm: *ruby1
- rvm: *ruby4
env: TEST_SUITE=memprof
name: "Profile Memory Allocation"
exclude:
Expand Down
2 changes: 1 addition & 1 deletion lib/jekyll/convertible.rb
Expand Up @@ -39,7 +39,7 @@ def read_yaml(base, name, opts = {})

begin
self.content = File.read(@path || site.in_source_dir(base, name),
Utils.merged_file_read_opts(site, opts))
**Utils.merged_file_read_opts(site, opts))
if content =~ Document::YAML_FRONT_MATTER_REGEXP
self.content = $POSTMATCH
self.data = SafeYAML.load(Regexp.last_match(1))
Expand Down
10 changes: 5 additions & 5 deletions lib/jekyll/document.rb
Expand Up @@ -298,7 +298,7 @@ def read(opts = {})
else
begin
merge_defaults
read_content(opts)
read_content(**opts)
read_post_data
rescue StandardError => e
handle_read_error(e)
Expand Down Expand Up @@ -429,14 +429,14 @@ def populate_categories
categories.flatten!
categories.uniq!

merge_data!("categories" => categories)
merge_data!({ "categories" => categories })
end

def populate_tags
tags = Utils.pluralized_array_from_hash(data, "tag", "tags")
tags.flatten!

merge_data!("tags" => tags)
merge_data!({ "tags" => tags })
end

private
Expand All @@ -462,8 +462,8 @@ def merge_defaults
merge_data!(defaults, :source => "front matter defaults") unless defaults.empty?
end

def read_content(opts)
self.content = File.read(path, Utils.merged_file_read_opts(site, opts))
def read_content(**opts)
self.content = File.read(path, **Utils.merged_file_read_opts(site, opts))
if content =~ YAML_FRONT_MATTER_REGEXP
self.content = $POSTMATCH
data_file = SafeYAML.load(Regexp.last_match(1))
Expand Down
2 changes: 1 addition & 1 deletion lib/jekyll/tags/include.rb
Expand Up @@ -176,7 +176,7 @@ def realpath_prefixed_with?(path, dir)

# This method allows to modify the file content by inheriting from the class.
def read_file(file, context)
File.read(file, file_read_opts(context))
File.read(file, **file_read_opts(context))
end

private
Expand Down
2 changes: 1 addition & 1 deletion test/test_document.rb
Expand Up @@ -175,7 +175,7 @@ def setup_document_with_dates(filename)
}]
)
@site.process
@document = @site.collections["slides"].docs.select { |d| d.is_a?(Document) }.first
@document = @site.collections["slides"].docs.find { |d| d.is_a?(Document) }
end

should "know the front matter defaults" do
Expand Down
2 changes: 1 addition & 1 deletion test/test_filters.rb
Expand Up @@ -1036,7 +1036,7 @@ def to_liquid
posts = @filter.site.site_payload["site"]["posts"]
results = @filter.where_exp(posts, "post",
"post.date > site.dont_show_posts_before")
assert_equal posts.select { |p| p.date > @sample_time }.count, results.length
assert_equal posts.count { |p| p.date > @sample_time }, results.length
end
end

Expand Down