119 Commits

Author SHA1 Message Date
Samuel Giddins
bdc3363d0f [rubygems/rubygems] Update required_ruby_version to 3.1
3.0 has been EOL since march, drop support for it before the 3.4 release is cut

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

https://github.com/rubygems/rubygems/commit/fc1f03b06a
2024-10-04 20:01:51 +00:00
Hiroshi SHIBATA
00dc1cace8 Reapply "[rubygems/rubygems] Fix activation conflicts when circularly requiring a gem"
This reverts commit 04cf66765a8a9d48baea6d9aee266dc9aa21df27.
2024-01-22 09:57:10 +09:00
Hiroshi SHIBATA
d51f4c9288 Reapply "[rubygems/rubygems] Fix require of a default gem when unresolved gems depend on it"
This reverts commit 54552b89e73fc616ba47c1c87d33625af99cbce9.
2024-01-22 09:57:10 +09:00
Hiroshi SHIBATA
54552b89e7
Revert "[rubygems/rubygems] Fix require of a default gem when unresolved gems depend on it"
This reverts commit f1f5f22d22a149f20e019728b1ab35593d29d81a.
2024-01-19 12:12:33 +09:00
Hiroshi SHIBATA
04cf66765a
Revert "[rubygems/rubygems] Fix activation conflicts when circularly requiring a gem"
This reverts commit db44088c2a92040879386aa5f268db4c858e4e5b.

  https://github.com/ruby/ruby/actions/runs/7578672002/job/20641640821
  https://github.com/ruby/ruby/actions/runs/7578672002/job/20641641212
  https://github.com/ruby/ruby/actions/runs/7578672002/job/20641642031
2024-01-19 11:54:17 +09:00
David Rodríguez
db44088c2a [rubygems/rubygems] Fix activation conflicts when circularly requiring a gem
If a gem is required circular, and there are unresolved specs depending
on it, we may end up in an activation conflict.

The solution is to not try to activate unresolved gems when requiring a
default gem, regardless of it having already been activated or not.

https://github.com/rubygems/rubygems/commit/3b2b8f4e3e
2024-01-19 11:28:11 +09:00
David Rodríguez
f1f5f22d22 [rubygems/rubygems] Fix require of a default gem when unresolved gems depend on it
The following conditions must be met:

* A default gem is required.
* A previous require left some gems unresolved, and those dependencies
  themselves depend on the default gem.

In this case, rubygems require will first activate the default version
of the gem, then try to activate another unresolved version of the
default gem that conflicts with the first activation.

The solution is, if we are in the middle of requiring a default gem,
skip this step, because we have already activated it successfully.

https://github.com/rubygems/rubygems/commit/8cd5608db5

Co-authored-by: Stan Hu <stanhu@gmail.com>
2024-01-19 11:28:11 +09:00
David Rodríguez
8044e57907 [rubygems/rubygems] Add a comment to explain default gem activation
https://github.com/rubygems/rubygems/commit/291128268f
2024-01-19 11:28:10 +09:00
David Rodríguez
3757d9027c [rubygems/rubygems] Remove now unnecessary dups
https://github.com/rubygems/rubygems/commit/56ce2a6445
2023-11-13 11:06:10 +09:00
David Rodríguez
54511303a4 [rubygems/rubygems] Drop support for Ruby 2.6 and Ruby 2.7 in RubyGems
https://github.com/rubygems/rubygems/commit/10c26a483d
2023-11-13 11:06:10 +09: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.

https://github.com/rubygems/rubygems/commit/258c6eda80
2023-07-30 01:36:23 +00:00
Nobuyoshi Nakada
989f3add62 Warn default gems which will be gemified in future 2023-07-28 14:57:10 +09:00
Nobuyoshi Nakada
70eeec0cad [rubygems/rubygems] Simplify double loop
https://github.com/rubygems/rubygems/commit/630dc02112
2023-07-25 04:52:54 +00:00
Nobuyoshi Nakada
1b27e7aa1f [rubygems/rubygems] Use Monitor#synchronize to ensure to exit
https://github.com/rubygems/rubygems/commit/b424353239
2023-07-25 04:52:54 +00:00
Hiroshi SHIBATA
f24a86d83f util/rubocop -A --only Layout/EmptyLineAfterMagicComment 2023-03-23 17:18:49 +09:00
Hiroshi SHIBATA
4dd418f877 util/rubocop -A --only Style/FrozenStringLiteralComment 2023-03-23 17:18:49 +09:00
Hiroshi SHIBATA
2e3cd1dc3e [rubygems/rubygems] Enabled Style/RedundantReturn cop
https://github.com/rubygems/rubygems/commit/05cc97bdf8
2023-03-23 17:18:49 +09:00
Hiroshi SHIBATA
0eef33e113 [rubygems/rubygems] util/rubocop -A --only Style/Next
https://github.com/rubygems/rubygems/commit/e5868e92f7
2023-03-23 17:18:49 +09:00
Hiroshi SHIBATA
1a60012612 [rubygems/rubygems] util/rubocop -A --only Lint/RescueException
https://github.com/rubygems/rubygems/commit/e8a5db50af
2023-03-23 17:18:49 +09:00
Hiroshi SHIBATA
25ed2e7415 [rubygems/rubygems] util/rubocop -A --only Lint/EmptyExpression
Thread.report_on_exception is always defined after Ruby 2.4 or later.

https://github.com/rubygems/rubygems/commit/274da54f38
2023-03-23 17:18:49 +09:00
Hiroshi SHIBATA
5211900d37 util/rubocop -A --only Style/SymbolProc 2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA
0b632b9cdd [rubygems/rubygems] util/rubocop -A --only Style/ClassCheck
https://github.com/rubygems/rubygems/commit/1c3356a872
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA
4bb5ce8188 [rubygems/rubygems] util/rubocop -A --only Style/StringLiteralsInInterpolation
https://github.com/rubygems/rubygems/commit/cb554f6eb7
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA
83f9aa8f02 [rubygems/rubygems] util/rubocop -A --only Style/Alias
https://github.com/rubygems/rubygems/commit/fba6e94de9
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA
583fbc627c [rubygems/rubygems] util/rubocop -A --only Layout/EmptyLinesAroundModuleBody
https://github.com/rubygems/rubygems/commit/48c88466b7
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA
139f0927f5 [rubygems/rubygems] util/rubocop -A --only Performance/DoubleStartEndWith
https://github.com/rubygems/rubygems/commit/893da27e7c
2023-03-17 18:50:55 +09:00
David Rodríguez
a47c54131d [rubygems/rubygems] Remove ensure part in require
I've seen this error sometimes but never found it helpful, since the
culprit has never been thread/monitor related, so it just adds noise.

Right now I'm seeing an issue in CI where we seem to be crashing during
ensure and showing a weird backtrace:

```
#<Thread:0x000055821d7a73b8 /home/runner/work/rubygems/rubygems/lib/rubygems/request_set.rb:167 run> terminated with exception (report_on_exception is true):
/home/runner/work/rubygems/rubygems/lib/rubygems/platform.rb:141:in `==': undefined local variable or method `to_a' for false:FalseClass (NameError)
Did you mean?  to_s
	from /home/runner/work/rubygems/rubygems/lib/rubygems/core_ext/kernel_require.rb:168:in `!='
	from /home/runner/work/rubygems/rubygems/lib/rubygems/core_ext/kernel_require.rb:168:in `require'
	from /home/runner/work/rubygems/rubygems/lib/rubygems.rb:441:in `block in ensure_subdirectories'
	from /home/runner/work/rubygems/rubygems/lib/rubygems.rb:437:in `each'
	from /home/runner/work/rubygems/rubygems/lib/rubygems.rb:437:in `ensure_subdirectories'
	from /home/runner/work/rubygems/rubygems/lib/rubygems.rb:413:in `ensure_gem_subdirectories'
	from /home/runner/work/rubygems/rubygems/lib/rubygems/resolver/specification.rb:110:in `download'
	from /home/runner/work/rubygems/rubygems/lib/rubygems/request_set.rb:173:in `block (2 levels) in install'
```

Let's get this out of the picture in case that helps clarify the
culprit.

https://github.com/rubygems/rubygems/commit/87ce40b70e
2023-03-17 18:50:55 +09:00
David Rodríguez
4cbfd87e5a [rubygems/rubygems] Allow disabling RubyGems require decorations
Currently Bundler needs to do cumbersome operations to revert custom
RubyGems require on a `bundler/setup` context. This causes issues when
third party gems also monkeypatch require, since Bundler will also undo
those decorations.

This commit allows it to use the simpler approach of properly telling
RubyGems that it needs to default to built-in require without any extra
magic.

https://github.com/rubygems/rubygems/commit/1df5009e14

Co-authored-by: Xavier Noria <fxn@hashref.com>
2023-01-31 10:49:08 +09:00
Nobuyoshi Nakada
89546dce21 [rubygems/rubygems] [DOC] Remove internal document about Kernel monkey patch
https://bugs.ruby-lang.org/issues/19285

https://github.com/rubygems/rubygems/commit/1e22219ed4
2023-01-08 08:09:34 +00:00
Nobuyoshi Nakada
55aa1a206c [rubygems/rubygems] LoadError#path on the caught exception does not need to protect
https://github.com/rubygems/rubygems/commit/a31f5d1a18
2023-01-08 08:09:34 +00:00
Nobuyoshi Nakada
1a1b653c9c [rubygems/rubygems] Let RDoc parse the doc of Kernel#require
Since RDoc does not parse string literals as documents, `eval` the
entire file instead of embedding in a here-document.
On the contrary, as `gem_original_require` alias is an implementation
detail but not for users, it should not be documented.

https://github.com/rubygems/rubygems/commit/cad4cf16cf
2023-01-08 08:09:33 +00:00
Hiroshi SHIBATA
bbe56a6437 Merge RubyGems/Bundler master
from bfb0ae6977
2022-12-12 10:49:43 +09:00
Thomas E. Enebo
420bdba139 [rubygems/rubygems] Allow upcoming JRuby to pass keywords for Kernel#warn
jruby-head (which will be JRuby 9.4.0.0) can now properly process
the keywords to Kernel#warn.  I cannot think of any capability based
test for this so I constrained it using a version guard.  Only JRuby
will ever hit the version guard.

https://github.com/rubygems/rubygems/commit/cd468c7e0f
2022-10-22 08:01:24 +00:00
Hiroshi SHIBATA
44264b4fee Merge rubygems/bundler HEAD.
Pick from dfbb5a3811
2022-08-09 12:05:19 +09:00
Takuya Noguchi
d7ffd3fea4
RubyGems: Enable Style/StringLiterals cop
Signed-off-by: Takuya Noguchi <takninnovationresearch@gmail.com>
2022-07-22 12:07:23 +09:00
David Rodríguez
12a5fa408b Sync RubyGems & Bundler with upstream repo 2022-06-24 10:52:02 +09:00
Hiroshi SHIBATA
c082c6eb7c Sync RubyGems and Bundler with upstream 2021-07-07 15:31:52 +09:00
David Rodríguez
53468cc111 Sync latest development version of bundler & rubygems 2021-03-08 13:47:35 +09:00
Hiroshi SHIBATA
4aca77edde Merge prepare version of RubyGems 3.2.0 2020-12-08 17:30:02 +09:00
Hiroshi SHIBATA
b717f73402
Revert "Manually merged from https://github.com/rubygems/rubygems/pull/2636"
31a6eaabc165d8a222e176f2c809d90622d88ec2 is obsoleted with
  https://github.com/rubygems/rubygems/pull/3820
2020-09-23 22:01:44 +09:00
Hiroshi SHIBATA
31a6eaabc1
Manually merged from https://github.com/rubygems/rubygems/pull/2636
Enable Style/EmptyLinesAroundClassBody rubocop cop.
2020-09-23 21:02:56 +09:00
Jeremy Evans
1a935606b5 [rubygems/rubygems] Fix Kernel#warn override to handle backtrace location with nil path
It's very unlikely to hit this case, but it is possible, as
Thread::Backtrace::Location#path can return nil if the location is
a cfunc with no previous iseq.  See location_path in vm_backtrace.c
in Ruby.

https://github.com/rubygems/rubygems/commit/511935645a
2020-07-31 21:07:19 +09:00
Benoit Daloze
331fe6a88f [rubygems/rubygems] Ignore internal frames in RubyGems' Kernel#warn
* See https://github.com/oracle/truffleruby/issues/2046
* `<internal:` is a common prefix also used by core Ruby files in CRuby.
* test_no_kernel_require_in_*warn_with_uplevel already test this.
* Unfortunately just skipping `<internal:` in the Ruby implementation
  is not enough, because RubyGems' #warn would not skip the
  `<internal:` require (TruffleRuby defines #require in Ruby),
  and the Ruby implementation's #warn would not skip
  RubyGems's #require. The #caller_locations(0) look like this:

  warnee.rb:1:in `<top (required)>' # where #warn is called
  <internal:core> core/kernel.rb:234:in `gem_original_require' # not skipped by RubyGems' warn, skipped by the Ruby impl
  rubygems/core_ext/kernel_require.rb:54:in `require' # not skipped by the Ruby impl's warn, what would be shown without this fix
  warn.rb:1:in `<main>' # what would be correct

  warn.rb is
  require "warnee"
  warnee.rb is
  puts caller_locations(0), nil
  warn "oops", uplevel: 1

https://github.com/rubygems/rubygems/commit/7c838f7419
2020-07-31 21:07:19 +09:00
David Rodríguez
a89665b7b1 Enforce no empty lines around class body in rubygems
To normalize the code style with `bundler`.
2020-07-31 21:07:19 +09:00
David Rodríguez
955f1837a1 Use space inside block braces everywhere
To make rubygems code style consistent with bundler.
2020-06-15 21:20:37 +09:00
Yuki Nishijima
77ba8a1d61 [rubygems/rubygems] Use LoadError#path to figure out the argument passed to 'require'
https://github.com/rubygems/rubygems/commit/5995394ec4
2020-06-05 07:32:42 +09:00
David Rodríguez
b9d431a7b1 [rubygems/rubygems] Remove direct reference to PR
The code is quite different now, so I think the link might be even
confusing. If you want to know more, use git history.

https://github.com/rubygems/rubygems/commit/db872c7a18
2020-06-05 07:32:42 +09:00
David Rodríguez
f0f138aa5d [rubygems/rubygems] Fix $LOADED_FEATURES cache sometimes not respected
In the cases where the initial manually `-I` path resolution succeeded,
we were passing a full path to the original require effectively skipping
the `$LOADED_FEATURES` cache. With this change, we _only_ do the
resolution when a matching requirable path is found in a default gem. In
that case, we skip activation of the default gem if we detect that the
required file will be picked up for a `-I` path.

https://github.com/rubygems/rubygems/commit/22ad5717c3
2020-06-05 07:32:42 +09:00
David Rodríguez
07dca5c02c [rubygems/rubygems] Extract a local outside the loop
https://github.com/rubygems/rubygems/commit/da1492e9d7
2020-06-05 07:32:42 +09:00
David Rodríguez
5aa5aad48a [rubygems/rubygems] Refactor Gem.load_path_insert_index
https://github.com/rubygems/rubygems/commit/ae95885dff
2020-06-05 07:32:42 +09:00