Commit graph

109 commits

Author SHA1 Message Date
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
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
630dc02112
2023-07-25 04:52:54 +00:00
Nobuyoshi Nakada
1b27e7aa1f [rubygems/rubygems] Use Monitor#synchronize to ensure to exit
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
05cc97bdf8
2023-03-23 17:18:49 +09:00
Hiroshi SHIBATA
0eef33e113 [rubygems/rubygems] util/rubocop -A --only Style/Next
e5868e92f7
2023-03-23 17:18:49 +09:00
Hiroshi SHIBATA
1a60012612 [rubygems/rubygems] util/rubocop -A --only Lint/RescueException
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.

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
1c3356a872
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA
4bb5ce8188 [rubygems/rubygems] util/rubocop -A --only Style/StringLiteralsInInterpolation
cb554f6eb7
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA
83f9aa8f02 [rubygems/rubygems] util/rubocop -A --only Style/Alias
fba6e94de9
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA
583fbc627c [rubygems/rubygems] util/rubocop -A --only Layout/EmptyLinesAroundModuleBody
48c88466b7
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA
139f0927f5 [rubygems/rubygems] util/rubocop -A --only Performance/DoubleStartEndWith
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.

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.

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

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
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.

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.

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"
31a6eaabc1 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.

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

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'
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.

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.

22ad5717c3
2020-06-05 07:32:42 +09:00
David Rodríguez
07dca5c02c [rubygems/rubygems] Extract a local outside the loop
da1492e9d7
2020-06-05 07:32:42 +09:00
David Rodríguez
5aa5aad48a [rubygems/rubygems] Refactor Gem.load_path_insert_index
ae95885dff
2020-06-05 07:32:42 +09:00
David Rodríguez
a18e81d797 [rubygems/rubygems] Fix performance regression in require
Our check for `-I` paths should not go through all activated gems.

00d98eb8a3
2020-06-05 07:32:42 +09:00
David Rodríguez
1039c32de6 [rubygems/rubygems] Simplify nested require exceptions
7fbef2f0e3
2020-05-08 14:13:29 +09:00
David Rodríguez
96064e6f1c
Sync rubygems with current master (#2889) 2020-03-24 15:39:24 +09:00
Hiroshi SHIBATA
8c67080381
Revert "[rubygems/rubygems] Fix require issue with file extension priority"
This reverts commit d767da428c.

  It fails with spec/ruby/core/kernel/require_spec.rb:5
2020-02-06 22:07:39 +09:00
David Rodríguez
d767da428c
[rubygems/rubygems] Fix require issue with file extension priority
If `require "a"` is run when two folders have been specified in the -I
option including a "a.rb" file and a "a.so" file respectively, the ruby
spec says that the ".rb" file should always be preferred. However, the
logic we added in 6b81076d9
to make the -I option always beat default gems does not respect this
spec, creating a difference from the original ruby-core's require.

[the ruby spec says]: d80a6e2b22/core/kernel/shared/require.rb (L234-L246)

b3944384f4
2020-02-06 21:57:18 +09:00
Nobuyoshi Nakada
eb512c5a95
warn should be a global function 2019-12-13 21:38:50 +09:00
Hiroshi SHIBATA
82cc2843a9
Prepare to release RubyGems 3.1.0 final version. 2019-12-13 20:19:33 +09:00
Kazuhiro NISHIYAMA
d336db6568
Fix a typo 2019-11-13 15:04:49 +09:00
Hiroshi SHIBATA
f36a53d038
Only enabled mon_owned condition with Ruby 2.5+ 2019-11-12 19:36:41 +09:00
Koichi Sasada
fef4370b40 check more. 2019-11-12 10:07:45 +09:00