Commit graph

14675 commits

Author SHA1 Message Date
rm155
d0c1eef511
[ruby/singleton] Only use RactorLocalSingleton if Ractor is defined
f684d36a47
2024-10-01 17:59:42 +09:00
rm155
a6e96df573
[ruby/singleton] Change PerRactorSingleton to RactorLocalSingleton
1216a86303
2024-10-01 17:59:42 +09:00
rm155
136b30b414
[ruby/singleton] Improve Ractor-compliance; Create PerRactorSingleton
ec4f66d9c1
2024-10-01 17:59:42 +09:00
Earlopain
5ed67f4826 [ruby/rdoc] Only let browser search through source code until it's
expanded
(https://github.com/ruby/rdoc/pull/1181)

Something that's been bothering me is that while the source code is
not visible by default, the browser still jump to it when searching.
Adding the `visible` property prevents this.

Test it out yourself:
* `bundle exec rdoc`
* open `_site/index.html`
* Search for `NameError`

Before, you will get a match from `load_yaml` source code, after
you only get the match when that methods source code is expanded.

003126cc23
2024-09-30 11:32:45 +00:00
Hiroshi SHIBATA
8cd36a6dab
Don't warn the bundled gems that are migrated at Ruby 3.0.
We should stop warnings at some point. I decided to that period EOL-ed versions.
ex. In 2024, Ruby 3.0 is EOL. we removed webrick, rexml, rss from warning targets.
2024-09-30 18:53:21 +09:00
David Rodríguez
3a273c4742 [rubygems/rubygems] Fix error when changing a path source to a git source if frozen mode
4c79ab9b2e
2024-09-30 05:09:16 +00:00
Earlopain
7d318c2cb2 [rubygems/rubygems] Fix stub.activated? sometimes returning false after activation under bundler
Closes https://github.com/rubygems/rubygems/pull/8068

This issue only occurs if the underlying stub is a gem stub:
f56098d8a1/bundler/lib/bundler/stub_specification.rb (L109-L112)

9b0152b3d5
2024-09-30 05:08:48 +00:00
David Rodríguez
060932af98 [rubygems/rubygems] Fix old cache format detection when application is not source controlled
b2adcc0173
2024-09-30 05:08:25 +00:00
David Rodríguez
82f250af45 [rubygems/rubygems] gem cleanup no longer needs to reset paths
Since `Gem::Uninstaller` no longer changes paths either.

427059d45f
2024-09-30 05:07:58 +00:00
David Rodríguez
d4ac5c573b [rubygems/rubygems] Don't add duplicated specs to unresolved specs
This could happen when a regular gem shadows a default gem.

9ef70dd1f7
2024-09-30 05:07:57 +00:00
David Rodríguez
73d60df6e0 [rubygems/rubygems] Don't list duplicated version in Gem::Specification.reset warning
e6e3db821f
2024-09-30 05:07:57 +00:00
Hiroshi SHIBATA
3a9e48b9a4
Fixed warning condition with LoadError 2024-09-30 11:35:59 +09:00
Nobuyoshi Nakada
1f6d2e77d9
Remove leading spaces from LIBPATHFLAG and RPATHFLAG
Join with a space in `MakeMakefile#libpathflag` instead.
2024-09-29 23:07:16 +09:00
Ellen Marie Dash
47a3482a41 [rubygems/rubygems] Remove code that makes suggest_gems_from_name give worse results.
09ec67ffdf
2024-09-28 21:12:25 +00:00
David Rodríguez
d1324170b6 [rubygems/rubygems] Warning about PATH in --user-install mode is only necessary for gems with executables
2fe0f452a2
2024-09-27 16:49:32 +00:00
Stan Lo
098649bc59 [ruby/rdoc] Add home page link to output message
(https://github.com/ruby/rdoc/pull/1165)

The link is clickable in the terminal and opens the home page in the browser

b7d580afab
2024-09-27 13:58:36 +00:00
Hiroshi SHIBATA
ff3f61556f
Only warn fiddle as optional dependency 2024-09-27 18:39:05 +09:00
David Rodríguez
a70adce1ce Only warn about bundled gems when require succeeds 2024-09-27 17:03:45 +09:00
Nithin Bekal
d7e5133d6d [ruby/benchmark] Add example for Benchmark.realtime
0f278be6c1
2024-09-27 04:31:47 +00:00
Nithin Bekal
3209bb950b [ruby/benchmark] Specify unit of time for Benchmark.realtime
388236685c
2024-09-27 04:31:47 +00:00
Stan Lo
49057f36ef [ruby/irb] Bump version to v1.14.1
(https://github.com/ruby/irb/pull/1009)

04cd2317ef
2024-09-26 13:38:04 +00:00
Kevin Newton
b97ff7dfda [ruby/prism] Fix up lex difference when ~ heredoc with 0 dedent and line continuation
84a9251915
2024-09-25 18:35:05 +00:00
David Rodríguez
b48add3c65 [rubygems/rubygems] Fix bundler/inline overwriting lockfiles
This was introduced by 0b7be7bb77, because
the original patch was not adapted to some recent refactorings.

0bca60d6e5

Co-authored-by: Hiroshi SHIBATA <hsbt@ruby-lang.org>
2024-09-24 14:17:23 +00:00
Luke Gruber
2a0ee408af [ruby/error_highlight] Fix error with prism when method given no arguments
such as:

  p = Proc.new

This now matches the RubyVM::AbstractSyntaxTree behavior, which is
not to highlight anything.

d5c592a1ba
2024-09-24 13:28:01 +00:00
Kevin Newton
414a848cc6 [ruby/prism] Accept version shorthand like 3.4
098f1c4607
2024-09-24 13:21:36 +00:00
Benoit Daloze
ed4a55fc4d [ruby/prism] Accept all 3.3.x and 3.4.x Ruby versions for Prism.parse
a4fcd5339a
2024-09-24 12:24:19 +00:00
David Rodríguez
5228d349d9
[rubygems/rubygems] Restore gem_dir as an instance variable accessor
I suspect someone could be setting this instance variable, and the
previous changes made that no longer effective.

Also I implemented a previous TOOD in `full_gem_path` the other way
around:

> # TODO: This is a heavily used method by gems, so we'll need
> # to aleast just alias it to #gem_dir rather than remove it.

I made `gem_dir` an alias of `full_gem_path` rather than the opposite.

This alternative change keeps both methods symmetric without deprecating
either of them for now.

28983973a3
2024-09-24 15:33:31 +09:00
David Rodríguez
5f47f0f759
[rubygems/rubygems] Remove TODO I can't make much sense of
6d627e0671
2024-09-24 15:33:31 +09:00
Adam Hess
4b1e852d3e
[ruby/error_highlight] Prism added node_id and Node#breadth_first_search in the 1.0 release. These methods are required for Prism to be able to find the method from the backtrace.
https://github.com/ruby/prism/blob/main/CHANGELOG.md#100---2024-08-28

In practice you will likely only end up in this situation if you previously had pre-1.0 prism installed and upgrade Ruby to a version with Prism as the default parser.

cb574daf62
2024-09-24 15:33:31 +09:00
David Rodríguez
5d53993a37 [rubygems/rubygems] Don't try to auto-install dev versions of Bundler not available remotely
1a7a3fdeb9
2024-09-23 10:53:32 +00:00
Daniel Colson
d0925c075b [rubygems/rubygems] Ensure refs directory in cached git source
See https://github.com/rubygems/rubygems/issues/8046 for details

Prior to this commit a cached git source without a specific ref wouldn't
survive pushing to a remote and then pulling on a different machine.
We'd end up without a refs directory in the cache, at which point git
won't recognize it as a repo.

This commit fixes the problem by adding a refs directory if it's not
already there. This needs to be done as early as possible, so any git
commands will work as expected, so this commit adds it before creating
the app cached git proxy.

8c89f0b065
2024-09-23 10:49:21 +00:00
David Rodríguez
c071fedb32 [rubygems/rubygems] Fix bundle outdated with --group option
It was printing incorrect output and returning incorrect status.

96f5979c7d
2024-09-23 10:37:57 +00:00
Koichi ITO
75ed086348 [ruby/prism] Fix kDO_LAMBDA token incompatibility for Prism::Translation::Parser::Lexer
## Summary

This PR fixes `kDO_LAMBDA` token incompatibility between Parser gem and `Prism::Translation::Parser` for lambda `do` block.

### Parser gem (Expected)

Returns `kDO_LAMBDA` token:

```console
$ bundle exec ruby -Ilib -rparser/ruby33 -ve \
'buf = Parser::Source::Buffer.new("example.rb"); buf.source = "-> do end"; p Parser::Ruby33.new.tokenize(buf)[2]'
ruby 3.4.0dev (2024-09-01T11:00:13Z master eb144ef91e) [x86_64-darwin23]
[[:tLAMBDA, ["->", #<Parser::Source::Range example.rb 0...2>]], [:kDO_LAMBDA, ["do", #<Parser::Source::Range example.rb 3...5>]],
[:kEND, ["end", #<Parser::Source::Range example.rb 6...9>]]]
```

### `Prism::Translation::Parser` (Actual)

Previously, the parser returned `kDO` token when parsing the following:

```console
$ bundle exec ruby -Ilib -rprism -rprism/translation/parser33 -ve \
'buf = Parser::Source::Buffer.new("example.rb"); buf.source = "-> do end"; p Prism::Translation::Parser33.new.tokenize(buf)[2]'
ruby 3.4.0dev (2024-09-01T11:00:13Z master eb144ef91e) [x86_64-darwin23]
[[:tLAMBDA, ["->", #<Parser::Source::Range example.rb 0...2>]], [:kDO, ["do", #<Parser::Source::Range example.rb 3...5>]],
[:kEND, ["end", #<Parser::Source::Range example.rb 6...9>]]]
```

After the update, the parser now returns `kDO_LAMBDA` token for the same input:

```console
$ bundle exec ruby -Ilib -rprism -rprism/translation/parser33 -ve \
'buf = Parser::Source::Buffer.new("example.rb"); buf.source = "-> do end"; p Prism::Translation::Parser33.new.tokenize(buf)[2]'
ruby 3.4.0dev (2024-09-01T11:00:13Z master eb144ef91e) [x86_64-darwin23]
[[:tLAMBDA, ["->", #<Parser::Source::Range example.rb 0...2>]], [:kDO_LAMBDA, ["do", #<Parser::Source::Range example.rb 3...5>]],
[:kEND, ["end", #<Parser::Source::Range example.rb 6...9>]]]
```

## Additional Information

Unfortunately, this kind of edge case doesn't work as expected; `kDO` is returned instead of `kDO_LAMBDA`.
However, since `kDO` is already being returned in this case, there is no change in behavior.

### Parser gem

Returns `tLAMBDA` token:

```console
$ bundle exec ruby -Ilib -rparser/ruby33 -ve \
'buf = Parser::Source::Buffer.new("example.rb"); buf.source = "-> (foo = -> (bar) {}) do end"; p Parser::Ruby33.new.tokenize(buf)[2]'
ruby 3.3.5 (2024-09-03 revision ef084cc8f4) [x86_64-darwin23]
[[:tLAMBDA, ["->", #<Parser::Source::Range example.rb 0...2>]], [:tLPAREN2, ["(", #<Parser::Source::Range example.rb 3...4>]],
[:tIDENTIFIER, ["foo", #<Parser::Source::Range example.rb 4...7>]], [:tEQL, ["=", #<Parser::Source::Range example.rb 8...9>]],
[:tLAMBDA, ["->", #<Parser::Source::Range example.rb 10...12>]], [:tLPAREN2, ["(", #<Parser::Source::Range example.rb 13...14>]],
[:tIDENTIFIER, ["bar", #<Parser::Source::Range example.rb 14...17>]], [:tRPAREN, [")", #<Parser::Source::Range example.rb 17...18>]],
[:tLAMBEG, ["{", #<Parser::Source::Range example.rb 19...20>]], [:tRCURLY, ["}", #<Parser::Source::Range example.rb 20...21>]],
[:tRPAREN, [")", #<Parser::Source::Range example.rb 21...22>]], [:kDO_LAMBDA, ["do", #<Parser::Source::Range example.rb 23...25>]],
[:kEND, ["end", #<Parser::Source::Range example.rb 26...29>]]]
```

### `Prism::Translation::Parser`

Returns `kDO` token:

```console
$ bundle exec ruby -Ilib -rprism -rprism/translation/parser33 -ve \
'buf = Parser::Source::Buffer.new("example.rb"); buf.source = "-> (foo = -> (bar) {}) do end"; p Prism::Translation::Parser33.new.tokenize(buf)[2]'
ruby 3.3.5 (2024-09-03 revision ef084cc8f4) [x86_64-darwin23]
[[:tLAMBDA, ["->", #<Parser::Source::Range example.rb 0...2>]], [:tLPAREN2, ["(", #<Parser::Source::Range example.rb 3...4>]],
[:tIDENTIFIER, ["foo", #<Parser::Source::Range example.rb 4...7>]], [:tEQL, ["=", #<Parser::Source::Range example.rb 8...9>]],
[:tLAMBDA, ["->", #<Parser::Source::Range example.rb 10...12>]], [:tLPAREN2, ["(", #<Parser::Source::Range example.rb 13...14>]],
[:tIDENTIFIER, ["bar", #<Parser::Source::Range example.rb 14...17>]], [:tRPAREN, [")", #<Parser::Source::Range example.rb 17...18>]],
[:tLAMBEG, ["{", #<Parser::Source::Range example.rb 19...20>]], [:tRCURLY, ["}", #<Parser::Source::Range example.rb 20...21>]],
[:tRPAREN, [")", #<Parser::Source::Range example.rb 21...22>]], [:kDO, ["do", #<Parser::Source::Range example.rb 23...25>]],
[:kEND, ["end", #<Parser::Source::Range example.rb 26...29>]]]
```

As the intention is not to address such special cases at this point, a comment has been left indicating that this case still returns `kDO`.
In other words, `kDO_LAMBDA` will now be returned except for edge cases after this PR.

2ee480654c
2024-09-20 17:17:21 +00:00
Kevin Newton
f515a1ab4b [ruby/prism] Introduce partial_script option
b28877fa4f
2024-09-20 15:42:12 +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
tomoya ishida
34e008d075 [ruby/irb] Fix debug command in nomultiline mode
(https://github.com/ruby/irb/pull/1006)

* Fix debug command in nomultiline mode

* context.colorize_code -> context.colorize_input

71f4d6bfb5
2024-09-20 10:13:39 +00:00
David Rodríguez
cf29594c03 [rubygems/rubygems] Don't try to install locked bundler when --local is passed
907d46964d
2024-09-20 09:58:24 +00:00
Hiroshi SHIBATA
46ee05f05a
Added missing block arg 2024-09-19 16:23:08 +09:00
Akinori MUSHA
59db92a1a1 [ruby/set] 2024
ea95c5a3d2
2024-09-19 07:12:00 +00:00
Akinori MUSHA
e53d2f2092 [ruby/set] Reword the document for to_a and clarify the implementation notes
ref. https://github.com/ruby/ruby/pull/11453

3cf6d11bd2
2024-09-19 07:11:58 +00:00
David Rodríguez
461c48960d [rubygems/rubygems] Add a note about when hack can be removed
058b29fe98
2024-09-18 16:42:14 +00:00
David Rodríguez
ae214be9d6 [rubygems/rubygems] Fix TODO
2cd13005f6
2024-09-18 16:42:14 +00:00
David Rodríguez
47db8bc01c [rubygems/rubygems] Stop fighting with ourselves
7cf2fdcfa1
2024-09-18 16:42:13 +00:00
David Rodríguez
39679d7fab [ruby/uri] Fix spelling of "cannot"
77241d6508
2024-09-17 22:12:12 +00:00
David Rodríguez
b203e667c9 [rubygems/rubygems] Fix spelling, it's "cannot" rather than "can not"
3434f094a2
2024-09-17 20:09:07 +00:00
David Rodríguez
80e934c29c [rubygems/rubygems] Fix --local hitting the network when default gems are included
b9a2d4d539
2024-09-17 14:39:06 +09:00
David Rodríguez
7428709d20 [rubygems/rubygems] Inline a private method
Removes an (in my opinion) excessive indirection and handles options
more consistently.

642e6d2c0c
2024-09-17 14:39:04 +09:00
David Rodríguez
7e0934d33e [rubygems/rubygems] Consistently access install options through symbol keys
7ddf1dc70a
2024-09-17 14:39:04 +09:00
Kevin Newton
2ea1950510 [ruby/prism] Do not leak explicit encoding
Fixes [Bug #20744]

f1b8b1b2a2
2024-09-16 18:57:54 +00:00
tomoya ishida
6c4ce72609 [ruby/irb] Use InstructionSequence#script_lines to get method source
(https://github.com/ruby/irb/pull/1005)

It works with both prism and parse.y

bcfaa72d5a
2024-09-16 17:36:27 +00:00