Граф коммитов

57 Коммитов

Автор SHA1 Сообщение Дата
Hiroshi SHIBATA fb6cfb413d
Mark rdoc as bundled gems at Ruby 3.5 2024-05-09 17:39:57 +09:00
Eugene Kenny 67dd9af17e [Bug #20450] Remove rubyarchdir from bootsnap paths 2024-04-25 13:29:28 +09:00
Nobuyoshi Nakada 09638741ba [Feature #20335] `Thread.each_caller_location` arguments
Accecpt the same arguments as `caller` and `caller_locations`.
2024-04-17 18:47:07 +09:00
Masataka Pocke Kuwabara 76914d474d Fix error when default gem is loaded from `-r` option
This patch fixes an error when a default gem that will be migrated to
a bundled gem is loaded from `-r` option.

Problem
===

`bundle exec ruby -rostruct -e ''` unexpectedly raises the following error:

```console
$ ruby -v
ruby 3.4.0dev (2024-04-08T02:39:00Z master 6f7e8e278f) [arm64-darwin21]
$ bundle init && bundle install
$ bundle exec ruby -rostruct -e ''
/Users/kuwabara.masataka/.rbenv/versions/trunk/lib/ruby/3.4.0+0/bundled_gems.rb:111:in 'Gem::BUNDLED_GEMS.warning?': undefined method 'find' for nil (NoMethodError)

      caller = caller_locations(3, 3).find {|c| c&.absolute_path}
                                     ^^^^^
        from /Users/kuwabara.masataka/.rbenv/versions/trunk/lib/ruby/3.4.0+0/bundled_gems.rb:75:in 'block (2 levels) in Kernel#replace_require'
```

Solution
===

This patch uses a safe navigation operator to fix this problem. By this
change, the command will show the warning message correctly.

```console
$ bundle exec ruby -rostruct -e ''
warning: ostruct was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.5.0. Add ostruct to your Gemfile or gemspec.
```
2024-04-08 15:48:26 +09:00
Hiroshi SHIBATA 25e28559c1 Ignore warnings on the bundled gems repo 2024-04-03 18:07:31 +09:00
Hiroshi SHIBATA e651395210 Warn pstore for Ruby 3.5 2024-04-02 18:34:10 +09:00
Hiroshi SHIBATA 4db7c8a24a Warn ostruct for Ruby 3.5 2024-04-02 11:22:14 +09:00
Jean Boussier 219d7cc1aa lib/bundled_gems.rb: dynamically ignore Kernel.require decorators
Followup: https://github.com/ruby/ruby/pull/10347

This avoid directly referencing bootsnap and zeitwerk, and also
handle other gems that may decorate `require`.
2024-03-25 18:17:09 +09:00
Hiroshi SHIBATA 675dcf9153
Partly Revert "Show the chilled status of a String [ci skip]"
This reverts commit e720a6b485.
2024-03-25 15:04:56 +09:00
Nobuyoshi Nakada e720a6b485
Show the chilled status of a String [ci skip] 2024-03-25 14:33:20 +09:00
Hiroshi SHIBATA 6b1691ebe8 Remove rubylibdir from bootsnap 2024-03-25 14:33:03 +09:00
Xavier Noria d6e9367edb Skip Bootsnap and Zeitwerk in bundled gems warning 2024-03-25 14:33:03 +09:00
Hiroshi SHIBATA fdf1fa5f5f
Revert "Warn ostruct for Ruby 3.5"
This reverts commit 1acbdc76d6.

I need to remove ostruct from Rake or fix bundler example.

https://github.com/ruby/ruby/actions/runs/8277371220/job/22647605911#step:11:3428
2024-03-14 17:41:24 +09:00
Hiroshi SHIBATA 1acbdc76d6
Warn ostruct for Ruby 3.5 2024-03-14 17:07:23 +09:00
Hiroshi SHIBATA 149373ce7f
racc is extracted at Ruby 3.3, not 3.4 2024-01-09 17:14:55 +09:00
Nobuyoshi Nakada 46085ef970 [DOC] No ducuments for internal library 2023-12-19 10:20:40 +09:00
Samuel Giddins 83bdf127b8 Avoid warning when requiring bigdecimal/util when bigdecimal is in gemfile 2023-12-16 17:34:45 +09:00
Hiroshi SHIBATA c3ae4b6ae1
Revert "[Bug #20060] Properly return matched gem name in case of EXACT"
This reverts commit 75c40802cb.

  This change is now working correctly with warning cases.
2023-12-15 14:06:53 +08:00
David Rodríguez 8e37cd8a8b Fix gem detection for names with dash 2023-12-15 14:04:36 +08:00
Hiroshi SHIBATA 5a0cbc9344 Detect bootsnap from all frames 2023-12-14 07:48:08 +09:00
Hiroshi SHIBATA 8b0c626962 Skip warning feature with Bootsnap
Bootsnap modified full feature path to require. We can't handle it for
  warning correctly.
2023-12-14 07:48:08 +09:00
Akira Matsuda 75c40802cb [Bug #20060] Properly return matched gem name in case of EXACT
this follows up 4e6861d337
2023-12-14 07:47:56 +09:00
Hiroshi SHIBATA a7ad9f3836
We need only one line for detecting caller gem name 2023-12-13 17:30:48 +09:00
Hiroshi SHIBATA cc9826503d
Revert "Skip to warn like 'bigdecimal/util' feature."
This reverts commit 8f6cf72e66.
2023-12-08 20:25:04 +09:00
Hiroshi SHIBATA 8f6cf72e66
Skip to warn like 'bigdecimal/util' feature. 2023-12-08 15:57:08 +09:00
David Rodríguez 64e985333f Improve bundled gems warnings for subfeatures
Before, when requiring "bigdecimal/math" in a Bundler context:

> /Users/deivid/.asdf/installs/ruby/3.3.0-dev/lib/ruby/3.3.0+0/bigdecimal/math.rb:2: warning: bigdecimal was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.4.0. Add bigdecimal to your Gemfile or gemspec.

After:

> foo.rb:1: warning: bigdecimal/math is found in bigdecimal, which will no longer be part of the default gems since Ruby 3.4.0. Add bigdecimal to your Gemfile or gemspec.
2023-12-08 15:55:15 +09:00
David Rodríguez a530dfef2b Improve bundled gem warnings
Before, when requiring "bigdecimal" in a Bundler context:

> foo.rb:1: warning: bigdecimal which will no longer be part of the default gems since Ruby 3.4.0. Add bigdecimal to your Gemfile or gemspec.

After:

> foo.rb:1: warning: bigdecimal was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.4.0. Add bigdecimal to your Gemfile or gemspec.
2023-12-08 15:55:15 +09:00
David Rodríguez d61af5c49a The SINCE and WARNED hashes take gem names, not features 2023-12-08 15:55:15 +09:00
Hiroshi SHIBATA 214f6d6598 Move replace_require into bundled_gems.rb 2023-12-07 11:37:08 +09:00
Hiroshi SHIBATA c65bb5a0f8 Warn bundled gems before Ruby 3.4.0 2023-11-16 18:14:48 +09:00
Hiroshi SHIBATA 42f368ead5
Surpressing additional message if it missed to detect gem name 2023-11-02 15:48:34 +09:00
Hiroshi SHIBATA e10f7c9d5b
Fix to detect gem name logic. It's mistake to migrate bundled_gems.rb from rubygems_integration.rb
https://github.com/ioquatix/bake/pull/15#issuecomment-1777985097
2023-11-02 15:48:34 +09:00
Hiroshi SHIBATA e34e8b93f8
Support Pathname object for warning feature of bundled gems 2023-11-02 13:32:53 +09:00
Hiroshi SHIBATA 1640dbdedd
Sort gem names 2023-10-20 09:13:55 +09:00
Hiroshi SHIBATA 2a56a6c3af
racc is also extracted to bundled gems 2023-10-20 09:13:55 +09:00
Hiroshi SHIBATA ac8ece81f2 Tweak the grammar 2023-10-18 14:51:48 +09:00
Hiroshi SHIBATA 46766e922b normalize gem name without .so or .bundle 2023-10-18 14:51:48 +09:00
Hiroshi SHIBATA 3b690b726d reject bundled gems if they are declared in Gemfile 2023-10-18 14:51:48 +09:00
Hiroshi SHIBATA 35edc14ee1 Ignore duplicated warning with native extension 2023-10-13 16:22:09 +09:00
Hiroshi SHIBATA c6728caeb7 Fix wrong gem name 2023-10-13 16:22:09 +09:00
Hiroshi SHIBATA fe5329f032 Ignore warning on LoadError when running under Bundler 2023-10-13 16:22:09 +09:00
Hiroshi SHIBATA 62eea99a1c Added recovery instructions for RubyGems 2023-10-13 16:22:09 +09:00
Hiroshi SHIBATA fdf0589a95 Surpressing double warnings 2023-10-13 16:22:09 +09:00
Hiroshi SHIBATA b49346ee73 Warn only LoadError without Bundler environment 2023-10-13 16:22:09 +09:00
Hiroshi SHIBATA 57c2ae206f Move additional warnings for Gem author under Gem::BUNDLED_GEMS. 2023-10-13 16:22:09 +09:00
Hiroshi SHIBATA ea05ddbeff Move path normalization into Gem from Bundler class 2023-10-13 16:22:09 +09:00
Nobuyoshi Nakada 7d32011399 [Bug #19852] Use gem name without suffix 2023-08-26 02:47:04 +09:00
Hiroshi SHIBATA 70272ca65c
Warn for bigdecimal.so case too 2023-08-25 13:11:06 +09:00
Hiroshi SHIBATA 3a70afad32
prime is bundled gems since Ruby 3.1.0. We should warn it under the bundler environment 2023-08-25 12:56:47 +09:00
Hiroshi SHIBATA 28b2cb10d5
We should also warn when loading 'bigdecimal/*' libraries 2023-08-25 12:52:10 +09:00