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

Avoid activesupport deep_merge conflict #213

Merged
merged 1 commit into from
May 14, 2021

Conversation

GabrielNagy
Copy link
Member

github-changelog-generator depends on activesupport which defines Hash#deep_merge methods that behave differently and conflict with the ones from the deep_merge gem. Use the recommended way of avoiding this conflict, as per the deep_merge documentation.[1]

Also, revert the changes from #209 which cause unexpected behavior with generated fixtures.

[1] https://github.com/danielsdeleo/deep_merge#using-deep_merge-in-rails

github-changelog-generator depends on activesupport which defines
`Hash#deep_merge` methods that behave differently and conflict with the
ones from the `deep_merge` gem. Use the recommended way of avoiding this
conflict, as per the `deep_merge` documentation.[1]

Also, revert the changes from voxpupuli#209 which cause unexpected behavior with
generated fixtures.

[1] https://github.com/danielsdeleo/deep_merge#using-deep_merge-in-rails
@@ -22,7 +22,7 @@ class Generator
def generate(layout, options)
layout = prepare(layout)
tokens = tokenize_layout(layout)
config = {}.deep_merge(BASE_CONFIG)
config = {}.deeper_merge(BASE_CONFIG)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be just

Suggested change
config = {}.deeper_merge(BASE_CONFIG)
config = BASE_CONFIG.dup

Or does deeper_merge also duplicate CONFIG within BASE_CONFIG?

Taking a deeper look: what is consoleport? In none of the beaker projects I can find any documentation. Is it something that only one provider (abs?) needs? Safe for nfs_server.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly I have no idea... consoleport sounds like it could be a PE-specific thing, but I
don't know about nfs_server. I don't see them used anywhere in our projects... maybe it would make sense to remove both in a major release.

Or does deeper_merge also duplicate CONFIG within BASE_CONFIG?

That seems to be the case, object IDs are different with deeper_merge:

[20] pry(#<BeakerHostGenerator::Generator>)> BASE_CONFIG.dup["CONFIG"].object_id == BASE_CONFIG["CONFIG"].object_id
=> true
[21] pry(#<BeakerHostGenerator::Generator>)> {}.deeper_merge(BASE_CONFIG)["CONFIG"].object_id == BASE_CONFIG["CONFIG"].object_id
=> false

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like consoleport was introduced here and nfs_server here. Both are PE-specific. I think we should do a major version where we drop them. It's adding a lot of noise for something that's barely if at all used.

@ekohl ekohl merged commit 4144af6 into voxpupuli:master May 14, 2021
@GabrielNagy GabrielNagy deleted the deeper-merge branch May 14, 2021 09:39
@ekohl ekohl added the bug label Jun 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants