-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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 vendored thor gem polluting the global namespace #7305
Avoid vendored thor gem polluting the global namespace #7305
Conversation
Thanks for opening a pull request and helping make RubyGems and Bundler better! Someone from the RubyGems team will take a look at your pull request shortly and leave any feedback. Please make sure that your pull request has tests for any changes or added functionality. We use GitHub Actions to test and make sure your change works functionally and uses acceptable conventions, you can review the current progress of GitHub Actions in the PR status window below. If you have any questions or concerns that you wish to ask, feel free to leave a comment in this PR or join our #rubygems or #bundler channel on Slack. For more information about contributing to the RubyGems project feel free to review our CONTRIBUTING guide |
Good catch! We may need to tweak our vendoring scripts thought, since #7285 should catch this now as "invalid vendoring". |
I dont think this actually works, since Thor is re-opening the existing |
Good point, alternatively, we may want to skip this module from our vendored copy altogether, since |
7844af5
to
42c7f27
Compare
Thank you for your feedback! I removed LCSDiff module entirely from vendored Thor with the task introduced #7285. It's an awesome feature. |
Thanks, that feature is indeed cool. As per CI, you also need to remove the explicit requires of the file being removed. |
42c7f27
to
d6b9823
Compare
I’m sorry I removed |
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.
Looks great, thanks so much!
Avoid vendored thor gem polluting the global namespace (cherry picked from commit b82eca1)
Hi 👋 |
We generally don't do backports to versions older than current minor series (2.5.x in this case). @hsbt sometimes manages backports to old branches if the bugs fixed are important enough, but in this case since it affects Thor tests only, I would advice to let this be workaround in Thor's side. Actually, if Thor's ruby version support was aligned with Bundler that would be ideal for us, since that would simplify our lives when vendoring Thor. |
@deivid-rodriguez Thanks. I'll see what I can do in Thor. |
What was the end-user or developer problem that led to this PR?
When I ran specs in the Thor gem using the Bundler 2.4.22, I got the following warnings.
This is because when the Thor gem in this repo was updated to v1.3, the LCSDiff module was added as a top-level module in the PR as shown below. As both the LCSDiff in the Bundler and the Thor define the same name method, those warnings are shown.
rubygems/bundler/lib/bundler/vendor/thor/lib/thor/shell/lcs_diff.rb
Line 1 in 558f516
The Thor gem has a spec that checks there is no warning in $VERBOSE mode, so the test is broken when I use a Bundler that has the Thor v1.3.
What is your fix for the problem, implemented in this PR?
I added the Bundler namespace to the LCSDiff module as other vendor gems do.
Make sure the following tasks are checked