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

Handle empty config files #4052

Merged
merged 1 commit into from Dec 11, 2015

Conversation

Projects
None yet
4 participants
@Crunch09
Member

Crunch09 commented Oct 24, 2015

This is my first PR for jekyll and i tried to follow @parkr 's suggestion given in #4030.
SafeYAML.load_file returns false when processing empty files so we convert this into an empty hash for further processing. I wasn't sure if we should log a warning on empty config files, so i left it out for now.

@parkr

This comment has been minimized.

Show comment
Hide comment
@parkr

parkr Oct 24, 2015

Member

Thanks for your pull request!

As an alternative, you could use || {} in the YAML reader in safe_load_file. I approach you have here is a little more defensive than I think we need to be, considering YAML and TOML have fairly stable API's. What do you think about that approach?

SafeYAML.load_file(filename) || {}
Member

parkr commented Oct 24, 2015

Thanks for your pull request!

As an alternative, you could use || {} in the YAML reader in safe_load_file. I approach you have here is a little more defensive than I think we need to be, considering YAML and TOML have fairly stable API's. What do you think about that approach?

SafeYAML.load_file(filename) || {}
@Crunch09

This comment has been minimized.

Show comment
Hide comment
@Crunch09

Crunch09 Oct 26, 2015

Member

Thanks, your approach sounds good to me 👍 i'll fix the failing tests later today

Member

Crunch09 commented Oct 26, 2015

Thanks, your approach sounds good to me 👍 i'll fix the failing tests later today

@envygeeks envygeeks added this to the 3.1 milestone Oct 26, 2015

@envygeeks

This comment has been minimized.

Show comment
Hide comment
@envygeeks

envygeeks Oct 26, 2015

Contributor

Marking this for 3.1 because 3.0 is due today AFAIW.

Contributor

envygeeks commented Oct 26, 2015

Marking this for 3.1 because 3.0 is due today AFAIW.

Handle empty config files
SafeYAML.load_file returns `false` when processing empty files so we
convert this into an empty hash for further processing.

fixes #4030

@parkr parkr added the fix label Nov 5, 2015

parkr added a commit that referenced this pull request Dec 11, 2015

@parkr parkr merged commit 92adfd0 into jekyll:master Dec 11, 2015

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

parkr added a commit that referenced this pull request Dec 11, 2015

@jekyll jekyll locked and limited conversation to collaborators Feb 27, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.