-
Notifications
You must be signed in to change notification settings - Fork 62
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
Change HashDiff Constant to Hashdiff #65
Change HashDiff Constant to Hashdiff #65
Conversation
Test failures seem to be Rubocop issues that existed before this PR. |
Thanks a lot @jfelchner . WDYT @krzysiek1507 ? |
Why This Change Is Necessary ======================================================================== The name of this gem is `hashdiff`. There is another gem named `hash_diff`. When they are both required via dependencies, errors are thrown. Additionally since the behavior is different, gems that are relying on `hashdiff`'s behavior, may get `hash_diff`'s behavior and vice versa. The reason for the conflict is because, based on ruby conventions, _'s are the separators for camel case. So: ```ruby 'hashdiff'.camelize # => "Hashdiff" 'hash_diff'.camelize # => "HashDiff" ``` Unfortunately instead of making the base module of this gem `Hashdiff`, it's called `HashDiff` and it conflicts. How These Changes Address the Issue ======================================================================== We change all of the constants to the new constant, including in documentation and tests. Then we add a shim to allow the old constant to be used and therefore maintain backward compatibility. Finally we add a warning message for users of the gem that the old constant will be removed in the next major version bump. Side Effects Caused By This Change ======================================================================== A new warning is added when loading the gem.
Why This Change Is Necessary ======================================================================== `require_relative` is error-prone in certain situations, specifically in Ruby < 2.4 and should never be used for requires inside of gems. How These Changes Address the Issue ======================================================================== Revert the change from `require` to `require_relative`. Side Effects Caused By This Change ======================================================================== Fewer bugs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems legit. Just guess you gotta get it merged in
@liufengyun just remember this needs to be version |
Thank a lot @jfelchner 🎉 And thanks for reviewing @krzysiek1507 @luke-hill ! |
@liufengyun Could you please update the GitHub repository description as well? |
@bquorning It's changed now, thanks for the catch. |
Why This Change Is Necessary
The name of this gem is
hashdiff
. There is another gem namedhash_diff
. When they are both required via dependencies, errors arethrown. Additionally since the behavior is different, gems that are
relying on
hashdiff
's behavior, may gethash_diff
's behavior andvice versa.
The reason for the conflict is because, based on ruby conventions, _'s
are the separators for camel case.
So:
Unfortunately instead of making the base module of this gem
Hashdiff
,it's called
HashDiff
and it conflicts.How These Changes Address the Issue
We change all of the constants to the new constant, including in
documentation and tests.
Then we add a shim to allow the old constant to be used and therefore
maintain backward compatibility.
Finally we add a warning message for users of the gem that the old
constant will be removed in the next major version bump.
Side Effects Caused By This Change
A new warning is added when loading the gem.
References:
hash_diff
#45