Commit graph

14675 commits

Author SHA1 Message Date
David Rodríguez
0b1b8bc3ec [rubygems/rubygems] Don't remove platform specific variants from the lockfile unless necessary
Even if they don't match the current Ruby version, they could still work
in other rubies. So it's better to keep them.

9a3e583b0c
2025-01-14 12:24:37 +09:00
David Rodríguez
5c83d09ec8 [rubygems/rubygems] Tiny parameter rename
Just for consistency, since all the other methods in this class that
receive an array of dependencies use `deps`.

eca1341950
2025-01-14 12:24:37 +09:00
David Rodríguez
ae75c8877a [rubygems/rubygems] Extract SpecSet#version_for
a76fd6d3bf
2025-01-14 12:24:37 +09:00
Josh LeBlanc
aee0277e14 [rubygems/rubygems] Serialize gemspec when caching git source
8727d44024
2025-01-14 12:24:37 +09:00
Vasily Fedoseyev
c89bcbd58e [rubygems/rubygems] Do not fail on start when cannot find writable user directory on ruby 3.4
027cdc750a
2025-01-14 12:24:37 +09:00
Ellen Marie Dash
7389ca87b3 [rubygems/rubygems] Print message when blocking on a file lock.
3ca7ef214c
2025-01-14 12:24:37 +09:00
Earlopain
7c0b92a1c6 [ruby/prism] Fix parser translator tokens for %x(#{})
It falsely considered it to be a single backtick command

dd762be590
2025-01-13 18:02:28 +00:00
Earlopain
0a26a3de89 [ruby/prism] Fix parser translator heredoc dedention with leading interpolation
```rb
<<~F
  foo
#{}
  bar
F
```

has zero common whitespace.

1f3c222a06
2025-01-13 15:43:24 +00:00
Earlopain
566f9463c2 [ruby/prism] Fix parser translator tSPACE tokens for percent arrays
Tests worked around this but the incompatibility is not hard to fix.
This fixes 17 token incompatibilies in tests here that were previously passing

101962526d
2025-01-12 18:54:16 +00:00
Kevin Newton
14b9098459 [ruby/prism] Frozen strings in the AST
8d9d429155
2025-01-12 18:41:42 +00:00
Earlopain
48749afe61 [ruby/prism] Fix parser translator ranges for mulltiline strings with multiline bytes
A rather silly issue with a rather simple fix.
The ranges already use the offset cache, this effectivly double-encoded them.

66b65634c0
2025-01-12 18:34:36 +00:00
Earlopain
d0deec3ef3 [ruby/prism] Fix parser translator tokens for comment-only file
In https://github.com/ruby/prism/pull/3393 I made a mistake.
When there is no previous token, it wraps around to -1. Oops

Additionally, if a comment has no newline then the offset should be kept as is

3c266f1de4
2025-01-12 18:34:06 +00:00
Stan Lo
450d9dc8bf [ruby/irb] Group private methods together in IRB::Context
(https://github.com/ruby/irb/pull/1064)

This makes them easier to find and matches the convention of the codebase.

ce8fa6857c
2025-01-12 12:59:35 +00:00
Stan Lo
9f8defe8d2 [ruby/irb] Drop ColorPrinter's workaround for BasicObject
(https://github.com/ruby/irb/pull/1051)

`pp` 0.6.0+ includes https://github.com/ruby/pp/pull/26 to handle BasicObject,
so we can drop the workaround.

08908d43c7
2025-01-12 12:47:31 +00:00
Earlopain
723f31cf6b [ruby/prism] Fix binary encoding for the parser translator
Skipping detecting the encoding is almost always right, just for binary it should actually happen.

A symbol containing escapes that are invalid
in utf-8 would fail to parse since symbols must be valid in the script encoding.
Additionally, the parser gem would raise an exception somewhere during string handling

fa0154d9e4
2025-01-12 00:49:54 +00:00
Earlopain
70022224b2 [ruby/prism] Better comment token handling for the parser translator
There appear to be a bunch of rules, changing behaviour for
inline comments, multiple comments after another, etc.

This seems to line up with reality pretty closely, token differences for RuboCop tests go from 1129 to 619 which seems pretty impressive

2e1b92670c
2025-01-11 19:09:05 -05:00
Kevin Newton
117d6e145a [ruby/prism] Fix not receiver
`not foo` should be `!foo`
`not()` should be `!nil`

Fixes [Bug #21027]

871ed4b462
2025-01-11 19:09:05 -05:00
Earlopain
9c962ea792 [ruby/prism] Fix parser translator tokens for backslashes in single-quoted strings and word arrays
These are not line continuations. They either should be taken literally,
or allow the word array to contain the following whitespace (newlines in this case)

Before:
```
  0...1: tSTRING_BEG     => "'"
 1...12: tSTRING_CONTENT => "foobar\\\n"
12...16: tSTRING_CONTENT => "baz\n"
16...17: tSTRING_END     => "'"
17...18: tNL             => nil
```

After:
```
  0...1: tSTRING_BEG     => "'"
  1...6: tSTRING_CONTENT => "foo\\\n"
 6...12: tSTRING_CONTENT => "bar\\\n"
12...16: tSTRING_CONTENT => "baz\n"
16...17: tSTRING_END     => "'"
17...18: tNL             => nil
```

b6554ad64e
2025-01-11 19:09:05 -05:00
Earlopain
110461c509 [ruby/prism] Implement more string token escaping in the parser translator
This leaves `\c` and `\M` escaping but I don't understand how these should even work yet. Maybe later.

13db3e8cb9
2025-01-11 19:09:05 -05:00
Earlopain
283037f7e3 [ruby/prism] Better handle all kinds of multiline strings in the parser translator
This is a followup to #3373, where the implementation
was extracted

2637007929
2025-01-11 19:09:05 -05:00
Earlopain
80fe9a1c77 [ruby/prism] Better handle multiline interpolated strings in the parser translator
Much of this logic should be shared between interpolated symbols and regexps.
It's also incorrect when the node contains a literal `\\n` (same as for plain string nodes at the moment)

561914f99b
2025-01-11 19:09:05 -05:00
Earlopain
9f38ee11cb [ruby/prism] Fix parser translator ast for empty regex
In that specific case, no string node is emitted

1166db13dd
2025-01-11 19:09:05 -05:00
Earlopain
a234fd516f [ruby/prism] Fix parser translator ast for regex with line continuation
Turns out, the vast majority of work was already done with handling the same for heredocs

I'm confident this should also apply to actual string nodes (there's even a todo for it) but
no tests change if I apply it there too, so I can't say for sure if the logic would be correct.
The individual test files are a bit too large, maybe something else would break that currently passes.

Leaving it for later to look more closely into that.

6bba1c54e1
2025-01-11 19:09:05 -05:00
Earlopain
d1a70014f9 [ruby/prism] Fix parser translator ast when using anonymous forwarding in blocks/lambda
Blocks and lambdas inherit anonymous arguments from the method they are a part of.
They themselves don't allow to introduce new anonymous arguments.
While you can write this:
```rb
def foo(*)
  bar { |**| }
end
```
referecing the new parameter inside of the block will always be a syntax error.

2cbd27e134
2025-01-11 19:09:05 -05:00
Earlopain
7cbaa3b929 [ruby/prism] Fix an incompatibility with the parser translator
The offset cache contains an entry for each byte so it can't be accessed via the string length.

Adds tests for all variants except for this:
```
"fo
o" "ba
’"
```

For some reason, this still has the wrong offset.

a651126458
2025-01-11 19:09:05 -05:00
Kevin Newton
b0e64fcde8 [ruby/prism] Bump to v1.3.0
a679ee0e5c
2025-01-11 19:09:05 -05:00
Kevin Newton
b79152fd22 [ruby/prism] Support 3.5 for version option
6b6aa05bfb
2025-01-11 19:09:05 -05:00
Stan Lo
76b620b341 [ruby/irb] IRB.conf[:SAVE_HISTORY] should handle boolean values
(https://github.com/ruby/irb/pull/1062)

Although not documented, `IRB.conf[:SAVE_HISTORY]` used to accept boolean,
which now causes `NoMethodError` when used.

This commit changes the behavior to accept boolean values and
adds tests for the behavior.

8b1a07b2a8
2025-01-11 14:03:59 +00:00
Stan Lo
80d28785c4 [ruby/irb] Print more actionable message when the exception may be
an IRB issue
(https://github.com/ruby/irb/pull/1061)

4d74d39261
2025-01-11 12:59:21 +00:00
Stan Lo
039446f601 [ruby/irb] Gracefully handle incorrect command aliases
(https://github.com/ruby/irb/pull/1059)

* Gracefully handle incorrect command aliases

Even if the aliased target is a helper method or does not exist, IRB
should not crash.

This commit warns users in such cases and treat the input as normal expression.

* Streamline command parsing and introduce warnings for incorrect command aliases

9fc14eb74b
2025-01-10 21:29:34 +00:00
Hiroshi SHIBATA
3185550623 Make Pstore tests as optional 2025-01-10 10:19:39 +09:00
Hiroshi SHIBATA
cda268d8e9 Make logger as bundled gems 2025-01-10 10:19:39 +09:00
Hiroshi SHIBATA
b0d3771bce Make benchmark as bundled gems 2025-01-10 10:19:39 +09:00
Hiroshi SHIBATA
0c3dca6266 Make pstore as bundled gems 2025-01-10 10:19:39 +09:00
Ellen Marie Dash
d96cc52ef1 [rubygems/rubygems] Add credentials file path to "gem env".
There are 3 possible locations:

- $HOME/.gem/credentials
- $XDG_DATA_HOME/gem/credentials
- $HOME/.local/share/gem/credentials

c51756b96e
2025-01-09 18:13:57 +00:00
Kazuki Yamaguchi
e728170043 [ruby/rdoc] Finalize RDoc::Options before calling
RDoc::RDoc#parse_files
(https://github.com/ruby/rdoc/pull/1274)

Commit 6cf6e1647b, which went to v6.5.0, changed `RDoc::Options#parse`
to not call `#finish` in it. While the commit adjusted other call sites,
it missed `lib/rdoc/rubygems_hook.rb`.

`RDoc::Options#finish` prepares the include paths for `:include:`
directives. This has to be done before starting to parse sources.

I think this should fix https://github.com/ruby/net-http/issues/193 +
https://github.com/ruby/net-http/pull/194.

d62da8ca09
2025-01-08 16:17:57 +00:00
Hiroshi SHIBATA
5f4be3ad7e Make ostruct as bundled gems 2025-01-08 17:12:19 +09:00
Hiroshi SHIBATA
4a02a72ca5 Dont't use stub constants like LIBDIR in bundled_gems.rb 2025-01-08 11:55:39 +09:00
Mari Imaizumi
b9d29912dd [ruby/reline] Update to Unicode 16.0.0
(https://github.com/ruby/reline/pull/803)

24e6128676
2025-01-07 15:57:45 +00:00
mterada1228
be4567e194 [ruby/rdoc] Add missing RDoc::RubygemsHook API for gem server
(https://github.com/ruby/rdoc/pull/1270)

This PR fixes https://github.com/ruby/rdoc/pull/1269.

## Expected Behavior

`gem server` command is successful.

```console
$ gem server
Server started at http://[::]:8808
Server started at http://0.0.0.0:8808
```

http://127.0.0.1:8808/ works.

## Actual Behavior

`gem server` command doesn't work because `Gem::RDoc.load_rdoc` raises
`NoMethodError`.

```console
$ gem server
ERROR:  While executing gem ... (NoMethodError)
    undefined method 'load_rdoc' for class RDoc::RubygemsHook

    Gem::RDoc.load_rdoc
             ^^^^^^^^^^
        /Users/mterada/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/rubygems-server-0.3.0/lib/rubygems/server.rb:437:in 'Gem::Server#initialize'
        /Users/mterada/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/rubygems-server-0.3.0/lib/rubygems/server.rb:426:in 'Class#new'
        /Users/mterada/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/rubygems-server-0.3.0/lib/rubygems/server.rb:426:in 'Gem::Server.run'
        /Users/mterada/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/rubygems-server-0.3.0/lib/rubygems/commands/server_command.rb:83:in 'Gem::Commands::ServerCommand#execute'
        /Users/mterada/.rbenv/versions/3.4.1/lib/ruby/3.4.0/rubygems/command.rb:326:in 'Gem::Command#invoke_with_build_args'
        /Users/mterada/.rbenv/versions/3.4.1/lib/ruby/3.4.0/rubygems/command_manager.rb:253:in 'Gem::CommandManager#invoke_command'
        /Users/mterada/.rbenv/versions/3.4.1/lib/ruby/3.4.0/rubygems/command_manager.rb:194:in 'Gem::CommandManager#process_args'
        /Users/mterada/.rbenv/versions/3.4.1/lib/ruby/3.4.0/rubygems/command_manager.rb:152:in 'Gem::CommandManager#run'
        /Users/mterada/.rbenv/versions/3.4.1/lib/ruby/3.4.0/rubygems/gem_runner.rb:57:in 'Gem::GemRunner#run'
        /Users/mterada/.rbenv/versions/3.4.1/bin/gem:12:in '<main>'
```

## Versions

```console
$ rdoc -v
6.10.0
```

---------

b6a82244a2

Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
2025-01-07 00:53:50 +00:00
Mari Imaizumi
5698f4f2e1 [ruby/reline] Enter newline if cursor position is middle of input
(https://github.com/ruby/reline/pull/802)

* Enter newline if cursor position is middle of input

* Add ed_force_submit to allow input confirmation on non-final lines

8ef534e904
2025-01-06 19:21:09 +00:00
License Update
70decc857c [rubygems/rubygems] Update SPDX license list as of 2024-12-30
42aaaff15c
2025-01-06 07:19:23 +00:00
Mark Young
8a9f1e600f [ruby/logger] Provide a 'Changelog' link on rubygems.org/gems/logger
By providing a 'changelog_uri' in the metadata of the gemspec a
'Changelog' link will be shown on https://rubygems.org/gems/logger
which makes it quick and easy for someone to check on the changes
introduced with a new version.

Details of this functionality can be found on https://guides.rubygems.org/specification-reference/#metadata

c6c64b02a0
2025-01-06 01:20:56 +00:00
Mark Young
80b01cc567 [ruby/net-http] Provide a 'Changelog' link on rubygems.org/gems/net-http
By providing a 'changelog_uri' in the metadata of the gemspec a
'Changelog' link will be shown on https://rubygems.org/gems/net-http
which makes it quick and easy for someone to check on the changes
introduced with a new version.

Details of this functionality can be found on https://guides.rubygems.org/specification-reference/#metadata

eeb728fefe
2025-01-06 01:19:55 +00:00
Mark Young
ce09b43aa0 [ruby/ostruct] Provide a 'Changelog' link on rubygems.org/gems/ostruct
By providing a 'changelog_uri' in the metadata of the gemspec a
'Changelog' link will be shown on https://rubygems.org/gems/ostruct
which makes it quick and easy for someone to check on the changes
introduced with a new version.

Details of this functionality can be found on https://guides.rubygems.org/specification-reference/#metadata

47d84001eb
2025-01-06 01:19:45 +00:00
Mark Young
3b659457b8 [ruby/securerandom] Provide a 'Changelog' link on rubygems.org/gems/securerandom
By providing a 'changelog_uri' in the metadata of the gemspec a
'Changelog' link will be shown on https://rubygems.org/gems/securerandom
which makes it quick and easy for someone to check on the changes
introduced with a new version.

Details of this functionality can be found on https://guides.rubygems.org/specification-reference/#metadata

3e0249deaf
2025-01-06 01:19:30 +00:00
Earlopain
c037f5a28c [ruby/prism] Fix parser translator ast for heredoc with written newlines
Heredocs that contain "\\n" don't start a new string node.

61d9d3a15e
2025-01-05 18:12:44 +00:00
Stan Lo
9552bd590c
Sync IRB to 3e6c12b (#12486)
Sync IRB to 3e6c12b174c0a961d8065eae22f6c4afc7b2c3e8
2025-01-05 18:42:27 +09:00
tomoya ishida
a70206c439 [ruby/reline] Refactor utf-8 strings and invalid strings in test
code
(https://github.com/ruby/reline/pull/800)

* Remove invalid encoding string "\M-[char]" from test code, remove unused code/arg/options

* Omit unicode unnoralized input test in non-utf8 testcase

* Remove helper method and constant no longer used in testcode

* Change key binding test to use realistic bytes instead of invalid byte sequence

* Remove invalid byte sequence input from rendering test

yamatanooroti handles invalid byte sequence input "\M-[char]" and converts it to "\e[char]"
We don't need to use these invalid byte sequence and rely on the hack implemented in yamatanooroti

f09e7b154c
2025-01-05 06:57:25 +00:00
tomoya ishida
9a15672614 [ruby/reline] Fix bracketed paste and scrolling bug
(https://github.com/ruby/reline/pull/801)

* Fix set_pasting_state bug with bracketed paste

* Fix rendered cursor_y caching in case of rendering the screen without scroll_into_view

c5d5c444df
2025-01-05 04:57:23 +00:00