summaryrefslogtreecommitdiff
path: root/lib/bundled_gems.rb
AgeCommit message (Collapse)Author
2026-03-11Suppress bundled gems warning for subfeatures found outside stdlib [Bug #21828]Hiroshi SHIBATA
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12Fix bundled gems warning for all subfeatures of hyphenated gemsChris Hasiński
PR #15822 fixed the warning for direct hyphenated gem requires like `benchmark/ips` → `benchmark-ips`. However, hyphenated gems often provide multiple files under their namespace. For example, `benchmark-ips` provides: - benchmark/ips.rb - benchmark/timing.rb - benchmark/compare.rb When requiring `benchmark/timing`, the previous fix only checked for `benchmark-timing` gem (doesn't exist), not `benchmark-ips` which actually provides the file. This fix checks if ANY gem matching `{prefix}-*` is in the bundle specs, which covers all subfeatures provided by hyphenated gems. Reported in https://github.com/ruby/ruby/pull/15822#issuecomment-123456
2026-01-20Suppress bundled gem warning on `binding.irb'Daisuke Aritomo
This patch silences the "this won't work in the next version of Ruby" warning displayed when irb is autoloaded via `binding.irb`. main.rb:1: warning: irb used to be loaded from the standard library, but is not part of the default gems since Ruby 4.0.0. You can add irb to your Gemfile or gemspec to fix this error. /.../irb.rb:9: warning: reline used to be loaded from the standard library, but is not part of the default gems since Ruby 4.0.0. You can add reline to your Gemfile or gemspec to fix this error. From: main.rb @ line 1 : => 1: binding.irb /.../input-method.rb:284: warning: rdoc used to be loaded from the standard library, but is not part of the default gems since Ruby 4.0.0. You can add rdoc to your Gemfile or gemspec to fix this error. This warning is incorrect and misleading: users should not need to include irb (and its dependencies) to their Gemfiles to use `binding.irb`, even in future versions of Ruby. It is agreed that the runtime takes care of that.
2026-01-20Add commentsDaisuke Aritomo
2026-01-20Fake BUNDLE_GEMFILE and BUNDLE_LOCKFILE to let checks passDaisuke Aritomo
Bundler::Runtime#setup requires a real existing lockfile (see Bundler::SharedHelpers#default_lockfile).
2026-01-20[Bug #21723] Let `binding.irb` properly load irb by fixing force_activate()Daisuke Aritomo
This patch fixes a problem where `binding.irb` (= force_activate('irb')) fails under `bundle exec` when the Gemfile does not contain `irb` and does contain a gem which is (1) not installed in GEM_HOME (2) sourced using `path:`/`git:`. The original approach constructing a temporary definition fails since it does not set the equalivent of `path:`/`git:`. Always reconstructing a definition from a Gemfile and applying lockfile constraints should be a more robust approach. [Bug #21723]
2026-01-08Fix incorrect bundled gems warning for hyphenated gem namesChris Hasiński
When requiring a file like "benchmark/ips", the warning system would incorrectly warn about the "benchmark" gem not being a default gem, even when the user has "benchmark-ips" (a separate third-party gem) in their Gemfile. The fix checks if a hyphenated version of the require path exists in the bundle specs before issuing a warning. For example, requiring "benchmark/ips" now checks for both "benchmark" and "benchmark-ips" in the Gemfile. [Bug #21828]
2025-11-12tsort will be extracted at 4.1, not 3.6Hiroshi SHIBATA
2025-11-12Replace Ruby 3.5 with Ruby 4.0Hiroshi SHIBATA
2025-11-10[DOC] Update missing docsNobuyoshi Nakada
2025-07-10Warn to use tsort for Ruby 3.6 that will be released at 2026Hiroshi SHIBATA
2025-07-02Reduce allocations in `Gem::BUNDLED_GEMS.warning?`Joshua Young
2025-06-28Make `uplevel` suitable as the option to `Kernel#warn`Nobuyoshi Nakada
Make Gem::BUNDLED_GEMS.uplevel returns `nil` if `require` frame is not found, for the simplicity.
2025-06-28Use symbols as `level` instead of stringsNobuyoshi Nakada
2025-04-10Refactor bundled conditionHiroshi SHIBATA
Notes: Merged: https://github.com/ruby/ruby/pull/12847
2025-04-10The current force_activate always fails without GemfileHiroshi SHIBATA
Notes: Merged: https://github.com/ruby/ruby/pull/12847
2025-04-02Removed the warning targets for Ruby 3.1 because 3.1 is already EOLHiroshi SHIBATA
Notes: Merged: https://github.com/ruby/ruby/pull/13017
2025-02-06Improve bundled gems warning messagesDavid Rodríguez
Currently evenn if the require actually fails, they suggest that the file was actually loaded, which is confusing. I reworded them to reduce this confusion.
2025-02-06Rename "gem" to "name"David Rodríguez
The name "gem" could be confused with RubyGems activation method.
2025-02-06Simplify bundled gems warnings implementationDavid Rodríguez
Most of the stuff is not actually necessary.
2025-02-06Remove unnecessary SINCE_FAST_PATH constantDavid Rodríguez
If anything, I think this may be causing some false positives.
2025-01-24Added force_activate feature againHiroshi SHIBATA
Notes: Merged: https://github.com/ruby/ruby/pull/12624
2025-01-24irb and reline are now bundled gems, we don't need to skip workaround for themHiroshi SHIBATA
Notes: Merged: https://github.com/ruby/ruby/pull/12624
2025-01-08Dont't use stub constants like LIBDIR in bundled_gems.rbHiroshi SHIBATA
Notes: Merged: https://github.com/ruby/ruby/pull/12529
2024-12-24Fix bundled gems warning for sub feature locationsDavid Rodríguez
Notes: Merged: https://github.com/ruby/ruby/pull/12439
2024-12-23Fix code location in bundled gems warningsDavid Rodríguez
Notes: Merged: https://github.com/ruby/ruby/pull/12412
2024-12-23Find uplevel for bundled gems warnings just onceDavid Rodríguez
Notes: Merged: https://github.com/ruby/ruby/pull/12412
2024-12-12Fix LoadError's linking issueStan Lo
Original issue: https://github.com/ruby/rdoc/issues/1128 The problem is caused by the `# :stopdoc:` directive in `bundled_gems.rb`, which's scope covers the redefinition of `LoadError`. Since the goal of `# :stopdoc:` is to hide the documentation of `Gem::BUNDLED_GEMS`, we can use `# :nodoc:` on it instead. Notes: Merged: https://github.com/ruby/ruby/pull/12317
2024-11-27Rename environment name to more descriptiveHiroshi SHIBATA
Notes: Merged: https://github.com/ruby/ruby/pull/12179
2024-11-15Find .ext/common path from LOAD_PATH for out-of-place buildHiroshi SHIBATA
Notes: Merged: https://github.com/ruby/ruby/pull/12096
2024-11-15Port test_warn_sub_feature.rb to RSpec exampleHiroshi SHIBATA
Notes: Merged: https://github.com/ruby/ruby/pull/12096
2024-11-15fiddle provide sub-feature like fiddle/importHiroshi SHIBATA
Notes: Merged: https://github.com/ruby/ruby/pull/12096
2024-11-15Use environmental variable for bundled_gems_spec.rbHiroshi SHIBATA
Notes: Merged: https://github.com/ruby/ruby/pull/12086
2024-11-15Port test_warn_bundled_gems.rb to RSpec exampleHiroshi SHIBATA
Notes: Merged: https://github.com/ruby/ruby/pull/12086
2024-11-13We can't handle optional dependency without new API of Rubygems.Hiroshi SHIBATA
I don't want to make bundled_gems.rb more complex and complicate. Revert "Fixed warning condition with LoadError" This reverts commit 3a9e48b9a4860022f43d8101c0f3249299437886. Revert "Only warn fiddle as optional dependency" This reverts commit ff3f61556fb62d12d57d017f4c54f1a8fd5208be. Revert "Only `warn` about bundled gems when require succeeds" This reverts commit a70adce1ce5fae8eaae385214ac0d2e7d17c1103. Notes: Merged: https://github.com/ruby/ruby/pull/12072
2024-09-30Don't warn the bundled gems that are migrated at Ruby 3.0.Hiroshi SHIBATA
We should stop warnings at some point. I decided to that period EOL-ed versions. ex. In 2024, Ruby 3.0 is EOL. we removed webrick, rexml, rss from warning targets.
2024-09-30Fixed warning condition with LoadErrorHiroshi SHIBATA
2024-09-27Only warn fiddle as optional dependencyHiroshi SHIBATA
2024-09-27Only `warn` about bundled gems when require succeedsDavid Rodríguez
Notes: Merged: https://github.com/ruby/ruby/pull/11550
2024-09-13Dont't warn reline called from irb, reline is already declared at irb gemspecHiroshi SHIBATA
2024-09-06Merge GH-11492Hiroshi SHIBATA
Notes: Merged: https://github.com/ruby/ruby/pull/11560
2024-09-06Warn irb, reline for Ruby 3.5Hiroshi SHIBATA
Notes: Merged: https://github.com/ruby/ruby/pull/11560
2024-08-21Don't show script name when bundle exec and call ruby script directly.Hiroshi SHIBATA
Notes: Merged: https://github.com/ruby/ruby/pull/11418
2024-08-21Skip to show script name with using ruby -r optionHiroshi SHIBATA
Notes: Merged: https://github.com/ruby/ruby/pull/11418
2024-08-21Show correct script name with sub-feature caseHiroshi SHIBATA
Notes: Merged: https://github.com/ruby/ruby/pull/11418
2024-08-15Delete unnecessary rubocop disable commentKentaro Takeyama
Notes: Merged: https://github.com/ruby/ruby/pull/11357
2024-08-08We should use uplevel:2 in another case.Hiroshi SHIBATA
Like the following scenario with bootsnap, that frames are same or smaller than frame_to_skip(=3). --- "/Users/hsbt/.local/share/rbenv/versions/3.3-dev/lib/ruby/3.3.0/bundled_gems.rb:69:in `block (2 levels) in replace_require'" "/Users/hsbt/.local/share/gem/gems/bootsnap-1.18.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'" "test_warn_bootsnap.rb:11:in `<main>'" ---
2024-08-08lib/bundled_gems.rb: more reliable caller detectionJean Boussier
The `2` skipped frames went out of sync and now it should be `3`. Rather than just update the offset, we can implement a way that is adaptative as long as all require decorators are also called require. Also we should compute the corresponding `uplevel` otherwise the warning will still point decorators. Co-authored-by: "Hiroshi SHIBATA" <hsbt@ruby-lang.org>
2024-08-08Partly reverted 09638741ba4d9547a0e48af8c767744fb1d7f68dHiroshi SHIBATA
This change didn't work with Ruby 3.3. We should revert this to test bundled_gems.rb with Ruby 3.3.
2024-08-05Make sure to always use the right `warn`David Rodríguez
Notes: Merged: https://github.com/ruby/ruby/pull/11296