Commit graph

14659 commits

Author SHA1 Message Date
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
tomoya ishida
fa0478d355 [ruby/reline] Refactor handling key in LineEditor
(https://github.com/ruby/reline/pull/799)

Simplify the complicated flow of waiting_proc, wrap_method_call and run_for_operation

72c0ec0425
2025-01-03 14:27:44 +00:00
tomoya ishida
23018c2fb4 [ruby/rdoc] Fix prism_ruby superclass resolve order
(https://github.com/ruby/rdoc/pull/1267)

RDoc::Parser::PrismRuby wrongly resolves superclass of `class Cipher < Cipher; end` that exist in openssl.
Superclass resolve should be done before adding class.

57a4615a92
2025-01-03 11:13:57 +00:00
Nobuyoshi Nakada
e4fff86faf
[DOC] .document under lib/rdoc is split now 2025-01-02 11:26:51 +09:00
Nobuyoshi Nakada
e2081861ae [ruby/rdoc] [DOC] Ignore racc-generated files
(https://github.com/ruby/rdoc/pull/1265)

* [DOC] Ignore racc-generated files

Not only `.ry` sources, generated `.rb` files seem duplicate and
unnecessary.

* [DOC] Select files by .document files for syncing

fb7041ec98
2025-01-02 00:30:14 +00:00
tomoya ishida
3e8f0e5589 [ruby/reline] Support inserting C-c C-z C-\ with quoted_insert
(https://github.com/ruby/reline/pull/798)

e6eb5d2d3c
2025-01-01 14:41:58 +00:00
Stan Lo
c0e2623966 [ruby/rdoc] Add autolink_excluded_words option to ignore
cross-references
(https://github.com/ruby/rdoc/pull/1259)

This config will be handy when the project name is the same as a class or
module name, which is often the case for most of the projects.

ce77f51f63
2024-12-31 12:17:07 +00:00
sanfrecce-osaka
3650f2460f [ruby/irb] Fix broken history command with -g
(https://github.com/ruby/irb/pull/1057)

Local variable `grep` was always nil because the regular expression parsing options contained an unnecessary `\n`. `test_history_grep` did not detect this because it only asserted what was included in the output.

a282bbc0cf
2024-12-29 11:00:11 +00:00
Stan Lo
689bb193cc [ruby/irb] Use the documentation site as the source of truth
(https://github.com/ruby/irb/pull/1055)

* Use the documentation site as the source of truth

1. Remove detailed content from README.md and point links to the documentation site.
2. Remove the content of EXTEND_IRB.md and point links to the documentation site.

* Use GitHub pages as Rubygems' documentation target

d2b73cb91e
2024-12-28 19:17:06 +00:00
Stan Lo
609a555ee0 [ruby/irb] Add ri an alias to the show_doc command
(https://github.com/ruby/irb/pull/1054)

52e77dd113
2024-12-28 15:55:27 +00:00
Luiz Eduardo Kowalski
8fa1db79bd [rubygems/rubygems] Expand and comment the regex
0dd0e93bde
2024-12-27 18:54:54 +00:00
Luiz Eduardo Kowalski
6e46b9b8b3 [rubygems/rubygems] Add support for mise.toml file
809a2a17a7
2024-12-27 18:54:53 +00:00
David Rodríguez
11c9e4f1ce [rubygems/rubygems] Fix bundle outdated <GEM> failing if gems not installed
694d5f444e
2024-12-26 18:09:15 +00:00
Koichi ITO
f459d8dfb7 [ruby/prism] Support Ruby 3.5 for Prism::Translation::Parser
Follow up https://github.com/ruby/prism/pull/3336.

Development for Ruby 3.5 has begun on the master branch:
2f064b3b4b

aa49c1bd78
2024-12-26 14:15:00 +00:00
Yudai Takada
feba2b66ff [ruby/reline] Fix typos in comment
(https://github.com/ruby/reline/pull/796)

* s/Calcualte/Calculate/

* s/unneccesary/unnecessary/

db86bcd2bf
2024-12-26 10:27:24 +09:00
Hiroshi SHIBATA
0c0b739d97 Bump up RubyGems 3.7.0.dev and Bundler 2.7.0.dev 2024-12-26 10:27:24 +09:00
Ryan Davis
70e90d5276 [ruby/erb] Fix up some doco on erb
(https://github.com/ruby/erb/pull/56)

* ERB#result: Dropped mention of deprecated safe_level since it is no longer documented.

* Fixed grammar for chicken fried steak :P

4efd3437ac
2024-12-26 10:27:24 +09:00