Commit graph

82 commits

Author SHA1 Message Date
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
David Rodríguez
7f9eb888a3 [rubygems/rubygems] Reuse package from the installer for extracting the specification
Previously we would instantiate two different packages and extract the
specification from the package twice for each gem installed. We can
reuse the installer for this so that we just need to do it once.

e454f850b1
2022-06-11 18:43:28 +09:00
David Rodríguez
965c314e34 [rubygems/rubygems] Move security exception handling to the only place using it
ba975b3b7f
2022-06-11 18:43:27 +09:00
David Rodríguez
870e5a39d5 [rubygems/rubygems] Remove another unnecessary require
04e6a5ae31
2022-06-11 18:43:24 +09:00
David Rodríguez
692fec4e72 [rubygems/rubygems] Simplify Gem::Security::Exception handling
These days all these errors are raised as `Gem::Security::Exception` so
there's no need to do any matching on the exception message.

bd3403da57
2022-06-11 18:43:23 +09:00
David Rodríguez
572f3240fe [rubygems/rubygems] Remove unnecessary require
The `security_policies` method already requires it.

d19b088f2f
2022-06-11 18:43:23 +09:00
David Rodríguez
00e5e827b1 [rubygems/rubygems] Cleanup old legacy code
531d6b5fee
2022-05-09 21:25:23 +09:00
Hiroshi SHIBATA
ff3d7b720e Merge RubyGems and Bundler master 2022-02-28 11:39:20 +09:00
Hiroshi SHIBATA
69dc2ea465 Merge RubyGems-3.3.0 and Bundler-2.3.0 2021-12-21 15:27:05 +09:00
David Rodriguez
4edcda67b3
[rubygems/rubygems] Simplify gem downloading inside bundler
We can skip most stuff in `Gem::RemoteFetcher#download`, and use
`Gem::RemoteFetcher#update_cache_path` directly.

This has the benefit of allowing us to remove some workarounds to
support several rubygems versions, but also allows us to pass the target
folder where the gem should be downloaded directly and skip the logic
inside `Gem::RemoteFetcher#download` to infer the cache path. This will
be useful later to fix some issues with the `global_gem_cache` feature
flag.

8fe74a77e4
2021-10-25 20:48:51 +09:00
David Rodriguez
57d990ddab
[rubygems/rubygems] Raise original exception
3c93b9fd21
2021-10-25 20:48:51 +09:00
David Rodriguez
7b821bc9b5
[rubygems/rubygems] Add missing requires
These methods rescue a constant defined by `rubygems/remote_fetcher`,
so they should technically require it.

The require is provided by `gem_remote_fetcher` anyways but I was
running a unit spec that stubs that method, so I was getting an
undefined constant error hiding another error.

8bedae4034
2021-10-25 20:48:50 +09:00
Daniel Colson
7394514bde [rubygems/rubygems] Simplify and remove some unused code
When `install_with_build_args` was added in
be96283985,
there were two versions of the method: the default version in the base class that still
used the locking `with_build_args`, and an override in the `Future`
class (for Rubygems 2.0 and up) that yielded without calling
`with_build_args`.

The `with_build_args` version of the method was removed in
8a5b71e3e8
while removing a bunch of the old Rubygems compatibility code.

This commit removes `with_build_args`, since it no longer appears to be
used (the build args are passed as a keyword argument to
`spec.source.install` instead, since
be96283985).

The commit also removes `install_with_build_args` and the conditional
around it, since the method wasn't doing anything different than
`install`, and it had a comment that was no longer accurate.

ba543a60eb
2021-10-25 19:02:50 +09:00