Commit graph

14675 commits

Author SHA1 Message Date
Jacklyn Ma
4d0c5486a2 [rubygems/rubygems] update cache checksums to decrease string allocations
85371a961a
2024-05-24 21:04:21 +00:00
Kevin Newton
c7281e2d67 [ruby/prism] Fix up ruby_parser string concat
4b06eae0df
2024-05-24 19:27:44 +00:00
Kevin Newton
f8b750370e [ruby/prism] Remove Debug module
4d8929ff6a
2024-05-24 17:19:38 +00:00
Kevin Newton
745a948b6d [ruby/prism] Remove dynamic Debug module methods
b850794db9
2024-05-24 17:19:36 +00:00
David Rodríguez
6a7e4c40e1 [rubygems/rubygems] Neither --force flag or inline mode should mandate a remote resolution
50dd93e217
2024-05-24 15:02:31 +00:00
David Rodríguez
eef125fd09 [rubygems/rubygems] Fix error messages to not mention cached gems when they were not used
5ce9a7ff17
2024-05-24 15:02:30 +00:00
David Rodríguez
744dd5a362 [rubygems/rubygems] Fix performance regression on applications with a local cache
Even if all gems are properly installed and no resolve is needed, we
recently started always reading all packages in `vendor/cache` and
extracting specifications from them.

This commit fixes the problem by longer making considering cached specs
the default and only enable them when a resolve is actually needed.

edeb2c42bf
2024-05-24 15:02:30 +00:00
David Rodríguez
c23798c2c4 [rubygems/rubygems] Remove @remote instance variable from Definition
It's a sources specific concern, so keep it there. It allows to simplify
the code quite a lot.

639f0b72f4
2024-05-24 15:02:30 +00:00
David Rodríguez
ea7e3e7b78 [rubygems/rubygems] Give better message when resolving because there's no lockfile
4e048bc255
2024-05-24 15:02:29 +00:00
David Rodríguez
0f9781b5c1 [rubygems/rubygems] Use Definition#no_resolve_needed?
5074c58ffb
2024-05-24 15:02:29 +00:00
David Rodríguez
3832a1bda8 [rubygems/rubygems] Make code more symmetric
dc7c9f029a
2024-05-24 15:02:28 +00:00
Martin Emde
acdd19facc [rubygems/rubygems] Fiks speeling cott bye codespell
508ed917a5
2024-05-24 01:53:35 +00:00
Martin Emde
76e31d9aa9 [rubygems/rubygems] Remove MD5 ETag generation from compact index
This was an offramp for generated etags to allow existing caches
to be served until people could upgrade. It has been about 6 months
since the transitional version was released, so we can remove this
transitional code now.

4ec8cfe611
2024-05-23 22:57:26 +00:00
Hiroshi SHIBATA
2cc047df9a [ruby/rdoc] Bump up 6.7.0
a667e616e1
2024-05-23 01:17:32 +00:00
Kevin Newton
e575954887 [ruby/prism] Fix support for 'it' implicit local variable
53bbcfe513
2024-05-22 16:34:04 -04:00
Ellen Keal
5b9b6b4d2b [rubygems/rubygems] move git clone depth error handling to else branch
022eb473f8
2024-05-22 06:01:51 +00:00
Ellen Keal
ec9de0c471 [rubygems/rubygems] fix for gems not downloading from git via http
592a2fcd54
2024-05-22 06:01:50 +00:00
Vladimir Támara Patiño
911b7d1dcf [ruby/reline] Catches Errno::ENODEV and Errno::EBADF in
get_screen_size. Closes https://github.com/ruby/reline/pull/690
(https://github.com/ruby/reline/pull/702)

* Catches exceptions Errno::ENODEV and Errno::EBADF in get_screen_size. Closes https://github.com/ruby/reline/pull/690

* Just catching Errno::ENOTTY and Errno::ENODEV

a5b5298e4a
2024-05-22 04:16:42 +00:00
Kevin Newton
b20adf90e3 [ruby/prism] Fix up ruby_parser interpolation concatenation
79cec4be22
2024-05-21 18:45:16 +00:00
Kevin Newton
12386d36f0 [ruby/prism] Provide deprecated numeric method
77bf9038a2
2024-05-21 18:43:56 +00:00
Kevin Newton
89efb94fec [ruby/prism] Reconfigure rationals
This eliminates the subnode on RationalNode and replaces it with two
integer fields, which represent the ratio for the rational. It also
reduces those two integers if they both fit into 32 bits.

Importantly, this PR does not implement bignum reduction. That's something
I'd like to consider for the future, but it's simple enough for now to
leave them unreduced, which makes it more useful than it used to be.

86e06c7068
2024-05-21 14:27:46 -04:00
Kevin Newton
84d2bacb42 [ruby/irb] Reorder ruby lex clauses for unrecoverable first
(https://github.com/ruby/irb/pull/956)

When a syntax error includes multiple error messages, we want to
check for unrecoverable messages first so that we do not
accidentally match a recoverable error later in the message.

2f42b2360d
2024-05-17 02:44:57 +00:00
Olle Jonsson
b90ea8ae52 [ruby/find] find.gemspec: Drop executables dir config
This gem contains no executables.

7bd452155e
2024-05-17 02:05:31 +00:00
David Rodriguez
c55c11d7d5 [rubygems/rubygems] Fix binstubs sometimes not getting regenerated when --destdir is given
This was only working for gems also installed in the default gem home.

47df02dbd9
2024-05-16 13:34:33 +00:00
David Rodriguez
35c5c7edb9 [rubygems/rubygems] Refactor Gem::Specification#find_all_by_name
So that it can also be delegated to `Gem::SpecificationRecord`.

1407807a99
2024-05-16 13:34:33 +00:00
David Rodriguez
5111b3d479 [rubygems/rubygems] Fix gem uninstall --user-install for symlinked HOME's
7f0706a897
2024-05-16 11:55:53 +00:00
David Rodriguez
847fc9af18 [rubygems/rubygems] Fix error message calling method removed a long time ago
5fbe5e43d6
2024-05-16 11:55:52 +00:00
David Rodriguez
7857061ecd [rubygems/rubygems] Fix regression when caching gems from secondary sources
If `cache_all_platforms` setting is enabled, the secondary source was
no longer considering cached gems.

That means that if the remote secondary source has removed its gems,
then this was now resulting in an error while before the previously
cached gem from the source would still be used.

This commit restores previous behavior.

2d2cd00255
2024-05-16 09:21:32 +00:00
David Rodriguez
29a9ab0ba6 [rubygems/rubygems] Deprecate Bundler constants
6166e4bce1
2024-05-16 09:20:17 +00:00
David Rodriguez
9fd41480fb [rubygems/rubygems] Use RubyGems freebsd helper
5d03a346ab
2024-05-16 09:20:17 +00:00
David Rodriguez
4db76d198b [rubygems/rubygems] Add a FreeBSD platform helper
535c83d5be
2024-05-16 09:20:16 +00:00
David Rodriguez
965cb3ab4c [rubygems/rubygems] Fix issue when cleaning up plugin stubs
When `gem uninstall <gem> --install-dir <dir>` is run, if the version
removed had a plugin, and that same version happened to also be
installed globally, then the plugin stub would fail to be removed.

4e2fa0be77
2024-05-14 16:08:03 +00:00
David Rodriguez
bd84236169 [rubygems/rubygems] Extract a Gem::SpecificationRecord class
This class handles all logic to handle the list of specifications, given
a set of GEM_PATH directories. Makes `Gem::Specification` has less
responsibilities and will help with fixing some bugs next.

df280dbbed
2024-05-14 16:08:03 +00:00
David Rodriguez
c219ee00b4 [rubygems/rubygems] Fix typo in attribute documentation
8c9807092c
2024-05-14 16:08:02 +00:00
David Rodriguez
5628cc1229 [rubygems/rubygems] Add missing docs
Other analog methods are documented, so document this one too.

76da34d44d
2024-05-14 16:08:02 +00:00
David Rodriguez
91e3871970 [rubygems/rubygems] Simplify documentation
I don't think this method is any worse than others, let's only document
what it does.

dec722187f
2024-05-14 16:08:01 +00:00
David Rodriguez
4dc0b23018 [rubygems/rubygems] Remove redundant receivers
7b71965a70
2024-05-14 16:08:00 +00:00
Mari Imaizumi
4a1e4436a9 [ruby/reline] Bump version to 0.5.7
(https://github.com/ruby/reline/pull/704)

b9b3d392ff
2024-05-14 08:18:32 +00:00
Mari Imaizumi
9d01f657b3 [ruby/reline] Implement the undo command
(https://github.com/ruby/reline/pull/701)

* Refactor send

* Implement the undo command

* Fix @past_lines initialization

* Improve assertion

* Hide to save buffer in insert_pasted_text

* Replace @using_delete_command with @undoing

* Refactor `@past_lines`

4ab72f9cbd
2024-05-14 01:58:31 +00:00
David Rodriguez
5319587ac3 [rubygems/rubygems] Restore previous way of loading monitor
I'm not sure why but this particular change seems to have introduced
some flaky test failures. So I'll revert it.

668488014b
2024-05-13 18:04:55 +00:00
David Rodriguez
d1c172dfd0 [rubygems/rubygems] Don't load SharedHelpers unnecessarily
de4650f629
2024-05-13 18:04:55 +00:00
David Rodriguez
22dab73971 [rubygems/rubygems] Don't depend on Pathname unnecessarily
8c8aaecc48
2024-05-13 18:04:55 +00:00
Kevin Newton
b5e53e2f32 [ruby/prism] Rescue LoadError for ruby_parser as well
d4eb13e703
2024-05-13 16:31:55 +00:00
Koichi ITO
5931f857ab [ruby/prism] Add error handling for missing parser gem in Prism::Translation
Resolves https://github.com/ruby/prism/pull/2803.

This PR adds error handling for missing `parser` gem in `Prism::Translation`.

The `parser` gem is a required runtime dependency when using `Prism::Translation::Parser`.
But it is not required for other uses of Prism. To avoid unnecessary dependencies,
it is not added as a `runtime_dependency` in the prism.gemspec. Instead, if the dependency is missing,
instructions are given to add it to Gemfile.

## Before

```console
$ bundle exec ruby -e 'require "prism"; require "prism/translation/parser33"'
/Users/koic/.rbenv/versions/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:74:in `require': cannot load such file -- parser (LoadError)
from /Users/koic/.rbenv/versions/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
from /Users/koic/src/github.com/ruby/prism/lib/prism/translation/parser.rb:3:in `<top (required)>'
from /Users/koic/.rbenv/versions/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
from /Users/koic/.rbenv/versions/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
from /Users/koic/src/github.com/ruby/prism/lib/prism/translation/parser33.rb:6:in `<module:Translation>'
from /Users/koic/src/github.com/ruby/prism/lib/prism/translation/parser33.rb:4:in `<module:Prism>'
from /Users/koic/src/github.com/ruby/prism/lib/prism/translation/parser33.rb:3:in `<top (required)>'
from /Users/koic/.rbenv/versions/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
from /Users/koic/.rbenv/versions/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
from -e:1:in `<main>'
```

## After

```console
$ bundle exec ruby -e 'require "prism"; require "prism/translation/parser33"'
Error: Unable to load parser. Add `gem "parser"` to your Gemfile.
```

4880aec22d
2024-05-13 16:29:27 +00:00
Kevin Newton
e6340258f8 [ruby/prism] Autoload newlines and comment visitors
Having the @newline instance variable in every node adds up, and
since it is so rarely used, we only want to add it when necessary.

Moving this into an autoloaded file and moving the instance variable
out of the default initializers reduces allocated memory because the
nodes are now smaller and some fit into the compact list. On my
machine, I'm seeing about an 8% drop.

eea92c07d2
2024-05-13 15:34:47 +00:00
Samuel Giddins
02c8e6583b [rubygems/rubygems] Use a constant empty tar header to avoid extra allocations
716666f65f
2024-05-13 13:01:44 +00:00
Vít Ondruch
5880103450 [rubygems/rubygems] Use spec.base_dir to remove plugins
The plugin loader from `@gem_home` was removed during uninstallation.
However, this could leave behind the plugins for `--user-install`
installed gems.

Use `Gem::Specifictaions#base_dir` instead. This ensures that the plugin
loader for associated .gemspec is uninstalled.

6047f78210
2024-05-13 10:35:57 +00:00
David Rodriguez
899568cce9 [rubygems/rubygems] Fix error when Bundler installation is corrupted
If one upgrades the default copy of Bundler through `gem update
--system`, and then reinstalls Ruby without removing the previous copy.
Then the new installation will have a correct default bundler gemspec,
but a higher copy installed in site_dir.

This causes a crash when running Bundler and prints the bug report
template.

This could probably be fixed in Ruby install script, by removing any
previous Bundler default copies, but if the problem is already there, I
think it's best to print a proper user error.

ada6de765d
2024-05-13 09:19:45 +00:00
David Rodriguez
69c87619bd [rubygems/rubygems] Avoid standard requires while loading shared helpers
We should make sure Bundler does not trigger RubyGems require logic for
gem activation until it had the chance to register its own monkeypatches
to RubyGems.

fbd2ff86b9
2024-05-13 09:08:16 +00:00
David Rodriguez
e926298343 [rubygems/rubygems] Require things right before they're needed
07022e3f2f
2024-05-13 09:08:15 +00:00