Commit graph

12164 commits

Author SHA1 Message Date
David Rodríguez
1f9e66836b [rubygems/rubygems] Fix inline mode with multiple sources
If we're in inline mode, Bundler first resolves using only local gems,
and if some gems are missing, then it re-resolves using remote gems.
However, "source resolution" from the initial "local" try was being
memoized, resulting in Bundler not looking for some gems remotely in the
second resolution.

This commit forces a proper re-resolve in this case.

fdc631075e
2023-06-06 10:52:53 +09:00
Stan Lo
45ff2f4a89 [ruby/irb] Refactor ExtendCommand::Nop
(https://github.com/ruby/irb/pull/598)

* Rename conf to irb_context

* Drop Nop#irb method because it's only used by irb/ext/loader.rb

We don't need to expose this method to all command classes, especially
when it's just an alias of `irb_context.irb`.
2023-06-05 19:12:16 +00:00
Stan Lo
273b38475e [ruby/irb] Simplify irb_info command
(https://github.com/ruby/irb/pull/597)

0a0409c52b
2023-06-05 19:02:43 +00:00
ima1zumi
76ee4edb97 [ruby/irb] Fixed string escaping omissions
(https://github.com/ruby/irb/pull/599)

I received a `RegexpError` when I typed `::Array[`.
::Array[/Users/mi/ghq/github.com/ruby/irb/lib/irb/completion.rb:236:in `retrieve_completion_data': premature end of char-class: /^Array[/ (RegexpError)
2023-06-05 18:34:10 +00:00
Daniel Pepper
542c70aab7 [ruby/singleton] Simplify implementation of Singleton#instance.
(https://github.com/ruby/singleton/pull/9)

- Add more tests to cover rails' usage.
2023-06-05 04:29:37 +00:00
Hiroshi SHIBATA
3a4302c742 [ruby/singleton] Revert "Simplify the implementation
(https://github.com/ruby/singleton/pull/7)"

This reverts commit 545b6b61a4.

  This change break Rails CI: https://bugs.ruby-lang.org/issues/19711

911531d508
2023-06-05 01:10:26 +00:00
Stan Lo
4275a8098e [ruby/irb] Bump version to 1.7.0
(https://github.com/ruby/irb/pull/596)

c2e7002867
2023-06-04 15:24:30 +00:00
Stan Lo
e6bd1852fb [ruby/reline] Bump version to 0.3.5
(https://github.com/ruby/reline/pull/548)

4330a52572
2023-06-03 08:28:02 +00:00
Vinicius Stock
a4d92475f6 [ruby/rdoc] Auto-correct trailing new lines
4b68c0728a
2023-06-03 01:42:29 +00:00
Daniel Pepper
bebd05fb51 [ruby/singleton] Simplify the implementation
(https://github.com/ruby/singleton/pull/7)

Remove `__init__` and move logic to `included`.
2023-06-03 00:35:18 +00:00
Nobuyoshi Nakada
e38fb050fa [ruby/reline] Remove unnecessary conditions for
`Fiddle::TYPE_VARIADIC`
(https://github.com/ruby/reline/pull/547)

71ba3a9432
2023-06-02 12:18:06 +00:00
Nobuyoshi Nakada
729b92ea46 [ruby/uri] Drop support for 2.4
21baf2ba16
2023-06-02 05:27:06 +00:00
Hiroshi SHIBATA
d8f333491e [ruby/syntax_suggest] Use hard-coded filename for executables.
It's hard to handle between ruby/syntax_suggest and ruby/ruby at gemspec.

0ee7496668
2023-06-01 14:46:52 +09:00
Hiroshi SHIBATA
4bbeed6134 Merge RubyGems/Bundler master from 4076391fce5847689bf2ec402b17133fe4e32285 2023-05-30 21:50:07 +09:00
Jeremy Evans
ec9364e500 [ruby/racc] Remove ErrorSymbolValue reference
I cannot find where this is defined.  I'm guessing neither this
nor the else branch is ever hit.  I only found out when testing
VM changes, which had a bug that exposed this.

8983d0c134
2023-05-30 01:43:48 +00:00
Benoit Daloze
f61bd3ca80 [ruby/cgi] Add TruffleRuby support and add it in CI
1240fec9c9
2023-05-29 19:33:38 +00:00
Jun Aruga
57459b83a9
mkmf: Add the extra option --with-verbose to enable verbose mode. (#7863)
This commit is to add an extra option to enable verbose mode (V=1) in the
generated `Makefile` at runtime of the Ruby to print compiler command lines by
the commands below when building native extensions. It's possible to enable the
verbose mode by setting the environment variable `MAKEFLAGS="V=1"`[1]
implemented in GNU make. However, I wanted to make a consistent user-interface
not depending on the specific make's implementation.

```
$ ruby /path/to/extconf.rb -- --with-verbose
```

You can also add the extra option via rake-compiler gem.

```
$ rake compiler -- --with-verbose
```

If the extra option is not given, the value of the
`RbConfig::CONFIG["MKMF_VERBOSE"]` enabled by the configure option below is
used.

```
$ ./configure --enable-mkmf-verbose
```

For the unit tests, updated the following files.

* The `test/mkmf/test_configuration.rb` was created to test the cases with the
  `configuration` method and this implementation.
* Updated the `TestMkmf#assert_separately` to set the extra
  arguments in `test/mkmf/base.rb`. Updated tests using the `assert_separately`.
* Added tests for `MakeMakefile#with_config` in the `test/mkmf/test_config.rb`.

[1] https://www.gnu.org/software/make/manual/html_node/Variables_002fRecursion.html

Fixes [Bug #19695]

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2023-05-29 10:09:32 +02:00
tomoya ishida
d5ef373b11 [ruby/irb] Set maximum document dialog height by
preferred_dialog_height provided by Reline
(https://github.com/ruby/irb/pull/591)

df6907aca9
2023-05-28 09:20:18 +00:00
tomoya ishida
cf0b9e0db0 [ruby/reline] Fix scrolldown condition in dialog rendering
(https://github.com/ruby/reline/pull/541)

ad6faada3f
2023-05-27 15:07:29 +00:00
tomoya ishida
5d137a7f77 [ruby/reline] Use appropriate dialog height and reduce screen pushup
problem
(https://github.com/ruby/reline/pull/542)

* Provide preferred_dialog_height for dialog positioning

* Fix rendering test
2023-05-27 14:48:50 +00:00
Masafumi Koba
94e5ecbbdd [ruby/rdoc] Improve <summary> CSS on sidebar
- Use a smaller font size for the toggle symbol. (Currently, it seems a little too large)
- Use the child combinator (`>`) to unify selectors.
- Use `margin-left` instead of whitespace within the `content` property.
- Use `::` instead of outdated `:` for the pseudo-element symbol.
  (See https://developer.mozilla.org/en-US/docs/Web/CSS/::before)

61ce0a7d75
2023-05-26 16:26:46 +00:00
Masafumi Koba
54b7ce0bff [ruby/rdoc] Improve layout CSS
- Use the `grid` property for the page layout.
  - https://caniuse.com/css-grid
- Adjust the `<main>` margin.
- Make the sidebar responsive and resizable.
  - https://caniuse.com/css-math-functions
  - https://caniuse.com/css-resize

Note all modern browsers support the new CSS properties and functions used by this change.

2db5097c41
2023-05-26 16:24:57 +00:00
Sutou Kouhei
d83f32c34b [rubygems/rubygems] Load plugin immediately
We can install RubyGems plugin by "gem install XXX". The installed
plugin is used from the NEXT "gem ...".

For example, "gem install gem-src kaminari" doesn't use gem-src plugin
for kaminari. "gem install gem-src && gem install kaminari" uses
gem-src plugin for kaminari.

How about loading a plugin immediately when the plugin is installed?
If this proposal is implemented, "gem install gem-src kaminari" works
like "gem install gem-src && gem install kaminari".

4917d96f4c
2023-05-25 21:51:15 +00:00
Hiroshi SHIBATA
5ade6be777
Fixup 5bfb317a93 2023-05-25 16:09:29 +09:00
Hiroshi SHIBATA
5bfb317a93 [ruby/benchmark] Don't use version.rb
6d51b10500
2023-05-25 07:08:44 +00:00
Hiroshi SHIBATA
d1237bc3a4
Move gemspec files to top of lib directory.
They have version.rb files with same directory.
  But version.rb have been removed at https://github.com/ruby/ruby/pull/3375
  There is no reason to locate under the library name of directory.
2023-05-25 15:47:48 +09:00
Sutou Kouhei
88876f02c1 [ruby/csv] All Enumerable based methods consume the same lines with other methods
This may have a performance penalty. We should benchmark this.

GitHub: fix https://github.com/ruby/csv/pull/260

Reported by Lhoussaine Ghallou. Thanks!!!

acc05116c5
2023-05-25 01:44:17 +09:00
Sutou Kouhei
73c56e06c4 [ruby/csv] CSV#read consumes the same lines with other methods like CSV#shift
GitHub: fix https://github.com/ruby/csv/pull/258

Reported by Lhoussaine Ghallou. Thanks!!!

71e6d24e28
2023-05-25 01:44:17 +09:00
Mau Magnaguagno
a0709d0aae [ruby/csv] Remove no longer required refinements
(https://github.com/ruby/csv/pull/250)

Since PR #159, the minimum Ruby version is 2.5.0, a version which no
longer requires refinements for String#delete_suffix?, String#match? and
Regexp#match?.
2023-05-25 01:44:17 +09:00
Jenny Shen
061e01ee50 [rubygems/rubygems] Remove forward slash in key regardless if it contains __
33a02eec00
2023-05-23 18:37:09 +00:00
Jenny Shen
e854b050cc [rubygems/rubygems] Modify invalid key check to accept keys with colons
413033198b

Co-authored-by: Eric Herscovich <eric.herscovich@shopify.com>
2023-05-23 18:37:08 +00:00
TSUYUSATO Kitsune
92d6c9a7b1 [ruby/irb] Allow show_source for private methods
(https://github.com/ruby/irb/pull/589)

* Allow `show_source` for private methods

Fix https://github.com/ruby/irb/pull/577

* Pend tests on TruffleRuby

It seems `eval(..., __LINE__ + 1)` does not work.
Other similar tests are also pended on TruffleRuby, so I think it
is acceptable.

* Use `private_method_defined?` instead of `defined?`
2023-05-23 16:16:37 +00:00
Hiroshi SHIBATA
a7d7032100
Manually merge syntax_suggest-1.1.0 2023-05-23 10:05:47 +09:00
schneems
c638ffa700
[ruby/syntax_suggest] Fix
https://github.com/ruby/syntax_suggest/pull/187 Handle if/else with
empty/comment
line

Reported in #187 this code:

```
class Foo
  def foo
    if cond?
      foo
    else
      # comment
    end
  end

  # ...

  def bar
    if @recv
    end_is_missing_here
  end
end
```

Triggers an incorrect suggestion:

```
Unmatched keyword, missing `end' ?
   1  class Foo
   2    def foo
>  3      if cond?
>  5      else
   8    end
  16  end
```

Part of the issue is that while scanning we're using newlines to determine when to stop and pause. This is useful for determining logically smaller chunks to evaluate but in this case it causes us to pause before grabbing the "end" that is right below the newline. This problem is similar to https://github.com/ruby/syntax_suggest/pull/179.

However in the case of expanding same indentation "neighbors" I want to always grab all empty values at the end of the scan. I don't want to do that when changing indentation levels as it affects scan results.

There may be some way to normalize this behavior between the two, but the tests really don't like that change.

To fix this issue for expanding against different indentation I needed a way to first try and grab any additional newlines with the ability to rollback that guess. In #192 I experimented with decoupling scanning from the AroundBlockScan logic. It also added the ability to take a snapshot of the current scanner and rollback to prior changes.

With this ability in place now we:

- Grab extra empties before looking at the above/below line for the matching keyword/end statement
- If there's a match, grab it
- If there's no match, discard the newlines we picked up in the evaluation

That solves the issue.

513646b912
2023-05-23 10:05:47 +09:00
schneems
aaf815c626
[ruby/syntax_suggest] Refactor Scanner logic out of AroundBlockScan introduce history
AroundBlockScan started as a utility class that was meant to be used as a DSL for scanning and making new blocks. As logic got added to this class it became hard to reason about what exactly is being mutated when. I pulled the scanning logic out into it's own class which gives us a clean separation of concerns. This allowed me to remove a lot of accessors that aren't core to the logic provided by AroundBlockScan.

In addition to this refactor the ScanHistory class can snapshot a scan. This allows us to be more aggressive with scans in the future as we can now snapshot and rollback if it didn't turn out the way we wanted.

The change comes with a minor perf impact:

before: 5.092678   0.104299   5.196977 (  5.226494)
after: 5.128536   0.099871   5.228407 (  5.249542)

This represents a 0.996x change in speed (where 1x would be no change and 2x would be twice as fast). This is a 0.38% decrease in performance which is negligible. It's likely coming from the extra blocks being created while scanning. This is negligible and if the history feature works well we might be able to make better block decisions which is means fewer calls to ripper which is the biggest bottleneck.

While this doesn't fix https://github.com/ruby/syntax_suggest/issues/187 it's a good intermediate step that will hopefully make working on that issue easier.

ad8487d8aa
2023-05-23 10:05:47 +09:00
schneems
b8bf0a5272
[ruby/syntax_suggest] Fix warning message
The env var DEBUG does not work to produce detailed output. It is SYNTAX_SUGGEST_DEBUG. It was changed as part of the dead_end to syntax_suggest migration for Ruby 3.2

c41da7aab7
2023-05-23 10:05:47 +09:00
ima1zumi
8db13c179e [ruby/reline] Bump version to 0.3.4
(https://github.com/ruby/reline/pull/538)

1fb0753bc1
2023-05-20 09:31:43 +00:00
tomoya ishida
e8c9f727e8 [ruby/irb] Simplify each_top_level_statement
(https://github.com/ruby/irb/pull/576)

* Simplify each_top_level_statement, reduce instance vars

* Update lib/irb/ruby-lex.rb

Co-authored-by: Stan Lo <stan001212@gmail.com>

* Remove unused ltype from TestRubyLex#check_state response

* Remove unnecessary const path of TerminateLineInput

* Combine duplicated code state check into method

---------

172453cec4

Co-authored-by: Stan Lo <stan001212@gmail.com>
2023-05-19 13:48:08 +00:00
Adam Daniels
b54b388f2a [ruby/irb] Display mod key as Option on Darwin platforms
(https://github.com/ruby/irb/pull/584)

Check RUBY_PLATFORM for `darwin` and modify the mod key from `Alt` to
`Option`.
2023-05-19 01:33:32 +00:00
Stan Lo
cfb7997353 [ruby/irb] Refactor RubyLex's input/io methods
(https://github.com/ruby/irb/pull/583)

1. Make `RubyLex#set_input` simply assign the input block. This matches
   the behavior of `RubyLex#set_prompt`.
2. Merge `RubyLex#set_input`'s IO configuration logic with `#set_auto_indent`
   into `#configure_io`.
2023-05-18 19:00:33 +00:00
Stan Lo
b695f58d52 [ruby/irb] Print deprecation warning for help command
(https://github.com/ruby/irb/pull/567)

* Give show_doc its own command class

* Print deprecation warning for `help` command
2023-05-18 03:28:31 +00:00
Hiroshi SHIBATA
5f411b9b3e [rubygems/rubygems] Bump up thor-1.2.2
d9a003b4e7
2023-05-13 02:21:33 +00:00
Hiroshi SHIBATA
0ef6e718d9
Merge https://github.com/rubygems/rubygems/pull/6655 manually. 2023-05-10 15:02:29 +09:00
Samuel Giddins
9ed189e9aa
Update SPDX license list 2023-05-10 14:58:55 +09:00
Takumasa Ochi
5831f7c831 [rubygems/rubygems] Simplify code by Gem::Specification#runtime_dependencies
324139af8f
2023-05-08 08:56:22 +00:00
tomoya ishida
5eca327fc5 [ruby/reline] Fix dialog corrupts rendering by pushing up input line
too much
(https://github.com/ruby/reline/pull/524)

* Do not render dialog where it overflows screen

* Dialog rendering should Scroll down only when needed

* Refactor screen_y_range calculation

Co-authored-by: Stan Lo <stan001212@gmail.com>

---------

bc0e3d1310

Co-authored-by: Stan Lo <stan001212@gmail.com>
2023-05-07 13:18:13 +00:00
zzak
8b2884c0b5 [ruby/rdoc] Isolate root dir if specified
This ensures only files from the root directory are chosen, in order to allow a clean build from outside the source directory.

f3b389aa9e
2023-05-06 07:39:24 +00:00
Nobuyoshi Nakada
40438fc4d3 [ruby/rdoc] Drop the support for 2.5 or earlier because of CVE-2021-31799
26136138aa
2023-05-05 14:01:50 +00:00
Nobuyoshi Nakada
cfa6a892d0
Redirect to IO::NULL for the portability 2023-05-05 18:52:36 +09:00
Nobuyoshi Nakada
32cc6301b3 [ruby/rdoc] [DOC] stop documenting fallback MatchData#match_length
Also empty document of `Object`.

ce32a3102b
2023-05-02 17:06:36 +00:00