Commit graph

94 commits

Author SHA1 Message Date
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
Hiroshi SHIBATA
979d1fa5fe [rubygems/rubygems] Extract Gem::BUNDLED_GEMS from Bundler
e30e86aa60
2023-07-25 06:23:28 +00:00
Hiroshi SHIBATA
8fbe7d0295 [rubygems/rubygems] Skip warnings if bundled gems is already loaded
9583a7eb82
2023-07-25 06:23:28 +00:00
Hiroshi SHIBATA
422144d220 [rubygems/rubygems] Use Kernel.singleton_class
f2e8e054df
2023-07-25 06:23:27 +00:00
Hiroshi SHIBATA
6bb34a7684 [rubygems/rubygems] Don't reuse require argument
1712cd6149
2023-07-25 06:23:27 +00:00
Hiroshi SHIBATA
64530b545f [rubygems/rubygems] Added warnings targets for old version of Ruby
d0c1d97105
2023-07-25 06:23:26 +00:00
Hiroshi SHIBATA
fc5dbea4c3 [rubygems/rubygems] Added Ruby version for bundled gems to warnings
d61c1362e7
2023-07-25 06:23:26 +00:00
Hiroshi SHIBATA
ec600332fc [rubygems/rubygems] Simplefied condition
5238fcf234
2023-07-25 06:23:25 +00:00
Hiroshi SHIBATA
2424b921b2 [rubygems/rubygems] make bundled gemst list as constant under Gem namespace
438eac5447
2023-07-25 06:23:25 +00:00
Hiroshi SHIBATA
0ae227ebe2 [rubygems/rubygems] Also check Kernel.require for infinite loop
961d9ac1bd
2023-07-25 06:23:23 +00:00
Hiroshi SHIBATA
a23fe8e84d [rubygems/rubygems] Avoid infinite call of require
9c345bfa3e
2023-07-25 06:23:23 +00:00
Hiroshi SHIBATA
bb61e45ae7 [rubygems/rubygems] Keep Kernel#require private
cd59e73efa
2023-07-25 06:23:22 +00:00
Hiroshi SHIBATA
95cde6e4c2 [rubygems/rubygems] Don't use redefine_method
f733f90110
2023-07-25 06:23:22 +00:00
Hiroshi SHIBATA
f5e03ef31c [rubygems/rubygems] Warn if file is loaded without Gemfile
bf59dcdad1
2023-07-25 06:23:21 +00:00
Hiroshi SHIBATA
5bc1b56c14 [rubygems/rubygems] Auto-correct Performance/FlatMap
b696edcd73
2023-06-16 04:10:38 +00:00
Mercedes Bernard
3d5ec8401f [rubygems/rubygems] safe marshal gem versions when fetching Marshal.specs.4.8.gz
23880353c1
2023-02-23 08:50:02 +00:00
Hiroshi SHIBATA
38fa8eb4cb Merge rubygems/bundler master
Pick from e9304aed7e
2023-02-21 19:28:12 +09:00
Hiroshi SHIBATA
b7ad60a794 Merge RubyGems/Bundler master
from 72fd3dd209
2022-12-26 15:09:21 +09:00
Hiroshi SHIBATA
3eca1e438d Merge 16c3535413 2022-09-05 14:37:12 +09:00