Commit graph

12164 commits

Author SHA1 Message Date
HParker
9aca3528aa [ruby/yarp] Match EOF after newline behavior
in Ripper EOL after whitespace is returned as a on_nl node with the whitespace as the content

be16d1deed
2023-08-23 17:23:15 +00:00
Benoit Daloze
2d75069779 [ruby/yarp] Use require_relative for yarp/ffi
c0598f8805
2023-08-22 21:19:09 +00:00
Hiroshi SHIBATA
1c93288f8b
Added bigdecimal to warning targets for the bundled gems.
[Bug #19843]
2023-08-22 14:35:25 +09:00
Takashi Kokubun
eec7a3f9ee [ruby/erb] Version 4.0.3
c594f2fb86
2023-08-21 21:45:55 -07:00
Josh Nichols
0955ca342e [ruby/erb] Enable frozen_string_literal in all files
(https://github.com/ruby/erb/pull/49)

I was surprised to see erb show up when I was using memory_profiler on
my app. ERB::Compiler#compile has a blank string literal, and it
ended up allocating some 41532 blank strings for a relatively small surface
area.

b7e45c2bdc
2023-08-22 04:41:22 +00:00
Gaurav Khanna
b9ef819116 [rubygems/rubygems] Support ruby file: ".tool-versions" in Gemfile
(https://github.com/rubygems/rubygems/pull/6898)

Supports .tool-versions (ASDF) by checking for a line starting with "ruby"
before falling back to reading the entire file, as in .ruby-version.

6c0a3e793a
2023-08-21 20:14:35 +00:00
Stan Lo
ca6db02c2a [ruby/irb] Avoid overriding user's irb_name setting in debugger
integration
(https://github.com/ruby/irb/pull/688)

* Avoid overriding user's irb_name setting in debugger integration

Instead of always setting `irb_name` to `irb:rdbg`, it should respect
the user's setting and only append `:rdbg` to it.

* Introduce write_rc test helper

2ce7593351
2023-08-21 18:23:32 +00:00
Kevin Newton
0fd57ee01d [ruby/yarp] Handle interpolated regular expressions with the o flag for locals checking
db95191207
2023-08-21 10:43:12 -07:00
Stan Lo
86ac17efde [ruby/irb] Move input processing out of RubyLex
(https://github.com/ruby/irb/pull/683)

* Add a test case for Ctrl-C handling

* Test symbol aliases with integration tests

There are a few places that also need to check symbol aliases before
`Irb#eval_input`. But since the current command test skip them, we
don't have test coverage on them.

* Move each_top_level_statement and readmultiline to Irb

This will save RubyLex from knowning information about commands and aliases.

69cb5b5615
2023-08-21 15:42:15 +00:00
Benoit Daloze
2929c47243 [ruby/yarp] Add a convenience value method for numeric literals
a328f27d8f
2023-08-21 15:25:28 +00:00
Summer ☀️
725ca2f9d8 [ruby/irb] Support VISUAL env var, and prefer it over EDITOR
(https://github.com/ruby/irb/pull/686)

* Support `VISUAL` env var, and prefer it over `EDITOR`

* Update test/irb/test_cmd.rb

---------

399b872c31

Co-authored-by: Stan Lo <stan001212@gmail.com>
2023-08-20 17:22:01 +00:00
Stan Lo
314ccdd60c [ruby/reline] Bump version to 0.3.8
(https://github.com/ruby/reline/pull/582)

3840d1f958
2023-08-20 17:16:22 +00:00
tomoya ishida
405c295a21 [ruby/reline] Use fdiv for keyseq_timeout msec to sec conversion
(https://github.com/ruby/reline/pull/583)

a6504acd63
2023-08-20 17:03:32 +00:00
Stan Lo
7c226291d3 [ruby/reline] Remove Timeout usage
(https://github.com/ruby/reline/pull/580)

Timeout's implementation relies on Thread, which would conflict with
`ruby/debug`'s thread-freezing implementation and has casued issues like

- ruby/debug#877
- ruby/debug#934
- ruby/debug#1000

This commit avoids the issue by completely removing the use of Timeout.

d4f0cd3fe1
2023-08-20 10:40:55 +00:00
Josh Nichols
3544200513 [rubygems/rubygems] fix lint
75c0f27b7e
2023-08-20 09:07:11 +00:00
Josh Nichols
7c4431e61c [rubygems/rubygems] use a one-liner
46745885e8
2023-08-20 09:07:05 +00:00
Josh Nichols
e5efa01c7d [rubygems/rubygems] handle removing BUNDLE_, since using start_with? would still include that
235d9b38d8
2023-08-20 09:07:00 +00:00
Martin Emde
f0bf9391dc [rubygems/rubygems] Don't rely on globals when not matching regexp for "local."
e79ccdafd8
2023-08-20 09:06:54 +00:00
Josh Nichols
b5a0630cd0 [rubygems/rubygems] Use ! methods once we have a new copy of the string. Use .prepend to avoid allocating a new string.
2ac35a661f
2023-08-20 09:06:48 +00:00
Josh Nichols
29aab66e6b [rubygems/rubygems] call key.to_s once instead of multiple times to save when it's a symbol
535feb817c
2023-08-20 09:06:43 +00:00
Josh Nichols
239e35254b [rubygems/rubygems] Use value.match? only on Strings, which avoids allocating a matchdata, which is not used
cbf9ac93d7
2023-08-20 09:06:36 +00:00
Josh Nichols
598048e3dd [rubygems/rubygems] Use .to_s once in the beginning to save allocations if it's a symbol.
f8167db8a2
2023-08-20 09:06:31 +00:00
Josh Nichols
e921efa476 [rubygems/rubygems] name is often a symbol, so only to_s once to avoid allocating it multiple times
8eac49c429
2023-08-20 09:06:25 +00:00
Josh Nichols
7cb6cbee95 [rubygems/rubygems] String#start_with? is faster than regex with beginning boundaries
d7cde68034
2023-08-20 09:06:19 +00:00
Josh Nichols
b97e45d01a [rubygems/rubygems] Use ! methods on the array, since it is brand new. The individual keys are also new, so we can use ! methods on each individual one as well.
f2e912b9bb
2023-08-20 09:06:12 +00:00
Josh Nichols
2a61e1dccc [rubygems/rubygems] Use Array#union to join these, instead of with | multiple times. This saves allocating 2 arrays
48c03b33b7
2023-08-20 09:06:07 +00:00
Josh Nichols
79b187a45e [rubygems/rubygems] config is a new Hash, and config.values is a new Array. that means we can use bang methods to avoid allocating new copies
8bc13fa55f
2023-08-20 09:06:01 +00:00
Josh Nichols
921c2bba4e [rubygems/rubygems] ENV.to_h returns a new hash, so we can select! it to avoid allocating another hash.
`String#start_with?` is faster than regex that is bound to the start of
a string.

9b2006ef09
2023-08-20 09:05:56 +00:00
Samuel Giddins
7e5c3ec5b1 Update specification.rb
Co-authored-by: David Rodríguez <deivid.rodriguez@riseup.net>
2023-08-20 09:05:29 +00:00
Samuel Giddins
1935433f5f [rubygems/rubygems] Ensure that loading multiple gemspecs with legacy YAML class references does not warn
Before this, you would get constant redefinition warnings on Psych::DefaultKey

Additionally, ensure the retries wont continue infinitely in the case of the ArgumentError not being caused by Marshal trying to load the undefined classes

919e8c2de4
2023-08-20 09:05:17 +00:00
Akira Matsuda
f69f775f24 [rubygems/rubygems] choose_from_list may return nil index since
abacb0cb34

5e2e9d6e50
2023-08-20 09:04:38 +00:00
Kevin Newton
bd440bf85d [ruby/yarp] Bump to version 0.8.0
bfde753702
2023-08-19 01:14:10 +00:00
Ngan Pham
3d7a030112 [rubygems/rubygems] Resolve ruby version file relative to bundle root
This is a follow up to https://github.com/rubygems/rubygems/issues/6742.
This change makes it so that the version file is resolved relative to
the Bundle root instead of the working directory.

Why is this useful?

If you run a commnad (eg `rails`) from the `app/` directory, your bundle
would fail to load.

6d47ee98b9
2023-08-18 19:14:14 +00:00
John Hong
744bc4d5d0 [rubygems/rubygems] Make nil a valid license spec
675effb67e
2023-08-18 16:42:49 +00:00
License Update
20106fe227 [rubygems/rubygems] Update SPDX license list as of 2023-06-18
3db9165335
2023-08-18 08:21:13 +00:00
Kevin Newton
995fd11bde [ruby/yarp] Remove strange :"#arg_rest" local
66ecec218d
2023-08-18 00:06:57 +00:00
Martin Emde
e913431687 [rubygems/rubygems] Raise Gem::Package::FormatError on EOF, indicating corrupt gem
Gem::Package::TarReader::Entry now raises EOFError or returns nil
appropriately based on Ruby core IO.read and IO.readpartial behavior.

Zlib will respond accordingly by raising Zlib::GzipFile::Error on EOF.

When verifying a gem or extracting contents, raise FormatError similar
to other cases of corrupt gems.

Addresses a bug where Gem::Package would attempt to call size on nil
instead of raising a more descriptive and useful error, leading users
to assume the problem is internal to rubygems.

Remove unused error class TarReader::UnexpectedEOF that was never raised
since the NoMethodError on nil would happen first. Use EOFError instead.

dc6129644b
2023-08-17 23:16:57 +00:00
Takashi Kokubun
67b5f63e97
Render YARP templates in the build process (#8228) 2023-08-17 14:39:04 -07:00
Kevin Newton
81d715099c [ruby/yarp] Treat yp_buffer_t as an opaque pointer
Right now, we have to keep the buffer FFI object in sync with the
definition of yp_buffer_t because we access its fields directly. If
we add more fields or change the order, things will get out of sync.

Instead, let's treat yp_buffer_t as an opaque pointer and access
its fields through accessor functions directly. This is more
consistent with how we handle strings anyway.

878d845eff
2023-08-17 09:58:56 -07:00
Ngan Pham
75a4767525 [rubygems/rubygems] Add file option to ruby method in Gemfile
fb9354b7bf
2023-08-17 16:07:54 +00:00
Manu
7433c8f7dd [rubygems/rubygems] Clarify that bundle info takes a gem name
09ef74ef73
2023-08-17 10:39:31 +00:00
Takashi Kokubun
3873b1eb39 Resync YARP 2023-08-16 17:47:32 -07:00
Benoit Daloze
3536cad902 [ruby/yarp] Fixes so bundle exec rake can run on JRuby and TruffleRuby
e6cea4fa08
2023-08-16 17:47:32 -07:00
Kevin Newton
ecf2e84c05 [ruby/yarp] Add a CHANGELOG
b490ff0919
2023-08-16 17:47:32 -07:00
Kevin Newton
820a58c228 [ruby/yarp] Hide debug methods
aa0dc2f301
2023-08-16 17:47:32 -07:00
Kevin Newton
3d032cf3e8 [ruby/yarp] Simplify creation of numerics
e5f6ffa23a
2023-08-16 17:47:32 -07:00
Mike Dalessio
0f8091947d [ruby/yarp] Move the gem's C extension into lib/yarp/
and change the require from "yarp.so" to "yarp/yarp", which is more
aligned with existing community conventions for gems.

64b70e2658
2023-08-16 17:47:32 -07:00
Stan Lo
5a40f7db54 [ruby/irb] Encapsulate input details in Statement objects
(https://github.com/ruby/irb/pull/682)

* Introduce Statement class

* Split Statement class for better clarity

65e8e68690
2023-08-16 10:13:46 +00:00
David Rodríguez
fe240b672b
[rubygems/rubygems] Show better error when PAT can't authenticate to a private server
Before:

```
Fetching gem metadata from https://rubygems.org/........
Fetching source index from https://rubygems.pkg.github.com/my-org/

Bad username or password for https://x-access-token@rubygems.pkg.github.com/my-org/.
Please double-check your credentials and correct them.
```

After:

```
Fetching gem metadata from https://rubygems.org/........
Fetching source index from https://rubygems.pkg.github.com/my-org/

Access token could not be authenticated for https://x-access-token@rubygems.pkg.github.com/my-org/.
Make sure it's valid and has the necessary scopes configured.
```

2ae69c964a
2023-08-16 15:03:38 +09:00
David Rodríguez
e678affe70
[rubygems/rubygems] Bad auth should not fallback either
ba3ea27869
2023-08-16 15:03:38 +09:00