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

Leverage ruby feature to warn when requiring default gems not included in the bundle that will be turned into bundled gems in the future #6831

Merged
merged 16 commits into from Jul 25, 2023

Conversation

hsbt
Copy link
Member

@hsbt hsbt commented Jul 21, 2023

What was the end-user or developer problem that led to this PR?

When users load rexml after upgrading Ruby version, they got LoadError of rexml. Because rexml is now bundled gems, not default gems that is shipped with under RbConfig::CONFIG["rubylibdir"].

I want to eliminate this surprised situation.

What is your fix for the problem, implemented in this PR?

I added warning feature for bundled gems and default gems. When users did load default gems that are listed on our plan of bundled gems, we can notice to them.

Notification message is like this.

>> require "csv"
csv is not part of the default gems since Ruby 3.4.0. Add it to your Gemfile.
=> true

and I also notice bundled gems like this:

>> require "net-imap"
net-imap is not part of the default gems since Ruby 3.1.0. Add it to your Gemfile.
/Users/hsbt/.local/share/rbenv/versions/master/lib/ruby/3.3.0+0/bundler/rubygems_integration.rb:261:in `require': cannot load such file -- net-imap (LoadError)

I believe this feature is helpful for Bundler users.

also see https://bugs.ruby-lang.org/issues/19776

TODO

I didn't implement to notice about gemspec. If foo gem depends on csv intenally, This PR warns only about csv and Gemfile. We should also warn about foo.gemspec.

Make sure the following tasks are checked

@hsbt
Copy link
Member Author

hsbt commented Jul 21, 2023

@hsbt hsbt merged commit e2e2e7c into master Jul 25, 2023
92 checks passed
@hsbt hsbt deleted the warn-bundled-gems branch July 25, 2023 06:23
yahonda added a commit to yahonda/rubygems that referenced this pull request Jul 27, 2023
@deivid-rodriguez deivid-rodriguez changed the title Warn bundled gems Leverage ruby feature to warn when requiring default gems not included in the bundle that will be turned into bundled gems in the future Dec 7, 2023
@headius
Copy link
Contributor

headius commented Jan 23, 2024

@hsbt I think we could just include the same bundled_gems.rb in JRuby stdlib and get this functionality yes?

Of the 3.4 gems, only two have extensions: nkf, which we've fixed in ruby/nkf#15, and syslog, which JRuby provides with FFI (we should get that into the gem). I think they all would be good for warnings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants