Commit graph

112 commits

Author SHA1 Message Date
David Rodríguez
6a5808965b [rubygems/rubygems] Stop allowing calling #gem on random objects
4b8570ae15
2025-07-07 11:53:12 +09:00
David Rodríguez
6d8460e0a0
[rubygems/rubygems] Fix running gem commands in a bundle exec context
They should only load plugins from gems in the bundle.

a229507820
2025-06-19 10:23:36 +09:00
David Rodríguez
4281b95e53
[rubygems/rubygems] Move finding eigenclass to a method
5ad0737e77
2025-06-19 10:23:36 +09:00
David Rodríguez
061d8133ce
[rubygems/rubygems] Simplify hacks to integrate with RubyGems
33d91de732
2025-02-14 16:13:27 +09:00
David Rodríguez
e7de621b5a [rubygems/rubygems] Revert RubyGems plugins getting loaded on Bundler.require
These changes were included when adding bundler plugin hooks for
`Bundler.require`, but they seem completely unrelated to that feature,
and have caused several issues.

8d56551dcf
2025-01-16 19:41:12 +09:00
samisalamiws
fbe35bcc82 [rubygems/rubygems] Fix private registry credentials being written to logs
d070fa10c1

Co-authored-by: Artem Ignatyev <zazubrik@gmail.com>
2024-11-08 12:15:31 +00:00
David Rodríguez
ffd51926bf [rubygems/rubygems] Remove the need for some bundler monkeypatches
f530f8686d
2024-10-23 08:52:45 +00:00
David Rodríguez
f63873e7a2 [rubygems/rubygems] Remove more compatibility code with old RubyGems
74e8eff779
2024-10-10 14:51:32 +00:00
Samuel Giddins
dfa11551aa [rubygems/rubygems] More rubygems 3.2.x removals
Signed-off-by: Samuel Giddins <segiddins@segiddins.me>

272f3464a3
2024-10-04 20:01:52 +00:00
David Rodríguez
e77346153d [rubygems/rubygems] Remove compatibility code with old RubyGems
f11e42a3c5
2024-10-02 21:33:02 +00:00
Samuel Giddins
43e3416b70 [rubygems/rubygems] Unconditionally set installed_by_version
It has been supported since RubyGems 2.2.0 via 4525e45a4d

Signed-off-by: Samuel Giddins <segiddins@segiddins.me>

bf39c583e8
2024-09-20 14:26:13 +00:00
Nobuyoshi Nakada
c032e2c225 [rubygems/rubygems] Use caller_locations instead of splitting caller
Also limit caller ranges

a274b1af78
2024-07-18 04:20:07 +00:00
Thomas Marshall
b88ac94eec [rubygems/rubygems] Only validate resolution info in Bundler
This commit switches out the full gemspec validation for a partial one
which only performs resolution related checks. This will allow gem
authors to run `bundle` commands immediately after creating a new gem
with Bundler, rather than having to fix metadata validation issues in
the default gemspec.

d5aa9cae9d
2024-06-25 14:32:20 +00:00
Yuta Saito
3e4b694565 [rubygems/rubygems] Bundler integration for --target-rbconfig option
f9fb413a19
2024-06-18 00:59:36 +00:00
David Rodríguez
939d389c54 [rubygems/rubygems] Improve default gem handling by treating default gems as any other gem
For backwards compatibility, make sure default gems are still used as a
last resort when materializing, in case no remote, cached, or installed
specs are found.

93788f689f
2024-05-29 13:55:25 +00:00
David Rodriguez
5319587ac3 [rubygems/rubygems] Restore previous way of loading monitor
I'm not sure why but this particular change seems to have introduced
some flaky test failures. So I'll revert it.

668488014b
2024-05-13 18:04:55 +00:00
David Rodriguez
69c87619bd [rubygems/rubygems] Avoid standard requires while loading shared helpers
We should make sure Bundler does not trigger RubyGems require logic for
gem activation until it had the chance to register its own monkeypatches
to RubyGems.

fbd2ff86b9
2024-05-13 09:08:16 +00:00
Hiroshi SHIBATA
a95b46db06 [rubygems/rubygems] Track HEAD changes for old PR proposal
e3d180620c
2024-04-19 05:18:21 +00:00
David Rodríguez
d718654bb1
[rubygems/rubygems] Remove extension building sync stuff no longer present in RubyGems
59a85388b9
2023-12-14 20:22:48 +08:00
David Rodríguez
41095f4de0
[rubygems/rubygems] RubyGems > 3.2.0.rc.1 is now always provided
929b521f3a
2023-12-14 20:22:48 +08:00
David Rodríguez
778438d423
[rubygems/rubygems] Gem::Specification always has default_stubs now
30db1eb4a5
2023-12-14 20:22:48 +08:00
David Rodríguez
5cf6f7f885
[rubygems/rubygems] Remove more methods now defined in all RubyGems versions
e015200ffa
2023-12-14 20:22:48 +08:00
David Rodríguez
7564038864
[rubygems/rubygems] Remove check only necessary for ancient RubyGems
ffa2f03489
2023-12-14 20:22:48 +08:00
David Rodríguez
b300f5a0e1
[rubygems/rubygems] Revert "Improve default gem handling"
This reverts commit 091b4fcf2b.

dcade3235f
2023-12-14 20:22:48 +08:00
David Rodríguez
ac939d9ca3 [rubygems/rubygems] Improve default gem handling
If a gem is specified in the Gemfile (or resolved as a transitive
dependency), it's always resolved from remote/installed sources. Default
gems are only used as a fallback for gems not included in the bundle.

I believe this leads to more consistent behavior and more portable apps,
since all gems will be installed to the configured bundle path,
regardless of whether they are default gems or not.

091b4fcf2b
2023-12-13 13:02:22 +09:00
David Rodríguez
0b24c71a5a
[rubygems/rubygems] Improve enabling bundled gems warnings
7be5b40ca9
2023-12-12 10:04:57 +09:00
Hiroshi SHIBATA
214f6d6598 Move replace_require into bundled_gems.rb 2023-12-07 11:37:08 +09:00
Hiroshi SHIBATA
d411d8f5fe [rubygems/rubygems] Try to load Gem::BUNDLED_GEMS on Bundler
`bundle exec ruby foo.rb` ignore to load gem_prelude.rb. Because warnings feature
  is not working with `bundle exec ruby`.

a0d4ed92a7
2023-12-06 10:10:44 +00:00
Hiroshi SHIBATA
7415901ac2 Always revert or skip extended require of RubyGems. 2023-11-16 18:14:48 +09:00
Samuel Giddins
b69bbf588a [rubygems/rubygems] User bundler UA when downloading gems
Gem::RemoteFetcher uses Gem::Request, which adds the RubyGems UA.
Gem::RemoteFetcher is used to download gems, as well as the full index.
We would like the bundler UA to be used whenever bundler is making
requests.

This PR also avoids unsafely mutating the headers hash on the shared
`Gem::RemoteFetcher.fetcher` instance, which could cause corruption or
incorrect headers when making parallel requests. Instead, we create one
remote fetcher per rubygems remote, which is similar to the connection
segregation bundler is already doing

f0e8dacdec
2023-11-15 08:33:14 +00:00
Hiroshi SHIBATA
8942c73e6a [rubygems/rubygems] Disabled Style/HashSyntax for keyword arguments
9b61b33568
2023-10-23 07:59:08 +00:00
Samuel Giddins
205cbc09d3 [rubygems/rubygems] Reuse Gem::RemoteFetcher instance in bundler
Closes https://github.com/rubygems/rubygems/issues/7076

Bundler will now use the same (shared) remote fetcher instance that
RubyGems uses.

This will allow installs to use a shared connection pool, which
represents a significant performance improvement on a clean install.

cd87b40fe1
2023-10-19 21:40:21 +00:00
Hiroshi SHIBATA
3605c9ae60
Don't need to refer SINCE constant 2023-10-19 13:51:31 +09:00
Hiroshi SHIBATA
3b690b726d reject bundled gems if they are declared in Gemfile 2023-10-18 14:51:48 +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
Hiroshi SHIBATA
c2bdb198d7 Dont't handle inline Gemfile 2023-10-13 16:22:09 +09:00
Hiroshi SHIBATA
75644f98e5 Use Gem::BUNDLED_GEMS.warning? at Bundler.setup 2023-10-13 16:22:09 +09:00
Jean Boussier
9b2b2082a7 [rubygems/rubygems] Handled unknown gems in bundled gems warning
We have this code that started failing on 3.3.0-dev recently:

```
irb(main):002> require File.join(RbConfig::CONFIG["rubylibdir"], "observer.rb")
/opt/rubies/3.3.0-dev-09-29/lib/ruby/3.3.0+0/bundled_gems.rb:86:in `<': comparison of String with nil failed (ArgumentError)

    end + " which #{RUBY_VERSION < SINCE[gem] ? "will be" : "is"} not part of the default gems since Ruby #{SINCE[gem]}"
                                   ^^^^^^^^^^
	from /opt/rubies/3.3.0-dev-09-29/lib/ruby/3.3.0+0/bundled_gems.rb:86:in `warning?'
	from /opt/rubies/3.3.0-dev-09-29/lib/ruby/3.3.0+0/bundled_gems.rb:92:in `block in <module:BUNDLED_GEMS>'
	from <internal:/opt/rubies/3.3.0-dev-09-29/lib/ruby/3.3.0+0/rubygems/core_ext/kernel_require.rb>:42:in `block in require'
	from <internal:/opt/rubies/3.3.0-dev-09-29/lib/ruby/3.3.0+0/rubygems/core_ext/kernel_require.rb>:39:in `synchronize'
	from <internal:/opt/rubies/3.3.0-dev-09-29/lib/ruby/3.3.0+0/rubygems/core_ext/kernel_require.rb>:39:in `require'
	from (irb):2:in `<main>'
	from <internal:kernel>:187:in `loop'
	from /opt/rubies/3.3.0-dev-09-29/lib/ruby/gems/3.3.0+0/gems/irb-1.8.1/exe/irb:9:in `<top (required)>'
	from /Users/byroot/.gem/ruby/3.3.0/bin/irb:25:in `load'
	from /Users/byroot/.gem/ruby/3.3.0/bin/irb:25:in `<main>'
```

d67eddb295
2023-09-29 13:38:05 +00:00
Samuel Giddins
e52f9bd41e [rubygems/rubygems] Bundler error handling
63b422b71a
2023-09-20 02:03:02 +00:00
Hiroshi SHIBATA
f16c50772c [rubygems/rubygems] rubocop -a
f240bfad2a
2023-08-29 17:41:41 +09:00
Hiroshi SHIBATA
f7359e112a
Suggest to add bundled gems into gemspec if 3rd party gem try to load gem from Gem::BUNDLED_GEMS::SINCE
[Feature #19846]
2023-08-25 15:57:53 +09:00
Hiroshi SHIBATA
6b570ff2c0 Display call location with bundled gems warning 2023-08-04 21:12:09 +09:00
Hiroshi SHIBATA
ae8fd392d5 Fixed worng key of bundled_gems list 2023-08-04 21:12:09 +09:00
Hiroshi SHIBATA
a0b695b4e6 Also decorate warning message with future tense for bundler 2023-08-04 21:12:09 +09:00
Hiroshi SHIBATA
de91ce980a [rubygems/rubygems] Use Kernel.singleton_class
9be984f281
2023-08-01 00:31:22 +00:00
Nobuyoshi Nakada
0d86cc4caf [rubygems/rubygems] Use the dedicated method to convert file path
The dedicated method `File.path` to deal with pathname-like objects
has been provided since ruby 1.9.0.
Also adds a test for rubygems/rubygems#6837.

258c6eda80
2023-07-30 01:36:23 +00:00
Hiroshi SHIBATA
35517baae5 Use Gem::BUNDLED_GEMS::SINCE 2023-07-28 14:57:10 +09:00
Xavier Noria
437a4ccbf2 [rubygems/rubygems] Restore support for Pathname objects in the replaced require
f7b4282ef7
2023-07-27 23:07:19 +00:00
Hiroshi SHIBATA
cf1f2e9d06 [rubygems/rubygems] bin/rubocop -A
e8a4184429
2023-07-25 06:23:29 +00:00