Commit graph

14675 commits

Author SHA1 Message Date
David Rodríguez
83334ebb3c [rubygems/rubygems] Load gemspecs in the context of its parent also when using local overrides
0a6c1c53ce
2024-09-04 12:00:36 +00:00
tomoya ishida
9a766777d4 [ruby/reline] Split render_differential to LineEditor's rendering
logic and actual differential rendering part
(https://github.com/ruby/reline/pull/731)

c90f08f7e3
2024-09-04 11:58:03 +00:00
Hiroshi SHIBATA
56817865d6 [rubygems/rubygems] Removed unused stringio
Fixed https://github.com/rubygems/rubygems/pull/7996

16bfcac883
2024-09-04 08:57:17 +00:00
Durable Programming Team
675529b9c6 [rubygems/rubygems] standardize pretty-print output for Gem::Source and subclasses
6d5fbf82f1
2024-09-03 17:40:12 +00:00
tomoya ishida
f1349924df [ruby/irb] Fix easter_egg run without RDoc, fix input-method test
run without RDoc
(https://github.com/ruby/irb/pull/998)

* EasterEgg no longer depend on RDoc

* Run most of the input-method tests even if RDoc is not avialable

30fa1595d9
2024-09-03 15:45:40 +00:00
Mari Imaizumi
0889f64021 [ruby/reline] Add test for reset_variables in Reline::Config
(https://github.com/ruby/reline/pull/741)

* Fix reset variables

* Add assertion for reload

* Add helper method to get instance variable value of Reline::Config

386f619ff5
2024-09-03 15:32:29 +00:00
tomoya ishida
ad9d2c6435 [ruby/reline] Fix redisplay/insert_text called from pre_input_hook
(https://github.com/ruby/reline/pull/742)

* Fix redisplay/insert_text called from pre_input_hook

* Rename insert_pasted_text to insert_multiline_text

It is now used from Reline.insert_text which is not inserting pasted text

694a540939
2024-09-03 15:19:44 +00:00
Nobuyoshi Nakada
5fd3942466 [ruby/optparse] Prefer require_relative
bb08cd47a8
2024-09-03 04:43:25 +00:00
David Rodríguez
81c71efc55
Vendor securerandom in Bundler as well
It is loaded by `Fetcher` so in most case it's fine.

But if using `bundler/inline` and a gem need to be fetched,
`securerandom` will be loaded and cause a conflict.

Can be reproduced with:

```ruby
require 'bundler/inline'

gemfile do
  source 'https://rubygems.org'
  gem 'graphql', '~> 2.0'
  gem 'graphql-client', '~> 0.18'
end

require 'json'
require 'graphql/client'
require 'graphql/client/http'
```

Ref: https://github.com/rails/rails/pull/52473#issuecomment-2284667451

Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
2024-09-03 10:49:13 +09:00
David Rodríguez
e66e3cf1b9
Change automatiek to properly vendor securerandom
Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
2024-09-03 10:49:13 +09:00
David Rodríguez
053caa313b
Fix gem exec rails new foo failing on Ruby 3.2
The default version of securerandom (0.2.2) gets activated by RubyGems,
but does not match Rails requirements (>= 0.3), leading to an error like
this:

```
$ gem exec rails new repro
/Users/deivid/Code/rubygems/rubygems/lib/rubygems/specification.rb:2246:in `raise_if_conflicts': Unable to activate activesupport-7.2.1, because securerandom-0.2.2 conflicts with securerandom (>= 0.3) (Gem::ConflictError)
	from /Users/deivid/Code/rubygems/rubygems/lib/rubygems/specification.rb:1383:in `activate'
	from /Users/deivid/Code/rubygems/rubygems/lib/rubygems/specification.rb:1421:in `block in activate_dependencies'
	from /Users/deivid/Code/rubygems/rubygems/lib/rubygems/specification.rb:1403:in `each'
	from /Users/deivid/Code/rubygems/rubygems/lib/rubygems/specification.rb:1403:in `activate_dependencies'
	from /Users/deivid/Code/rubygems/rubygems/lib/rubygems/specification.rb:1385:in `activate'
	from /Users/deivid/Code/rubygems/rubygems/lib/rubygems/core_ext/kernel_gem.rb:62:in `block in gem'
	from /Users/deivid/Code/rubygems/rubygems/lib/rubygems/core_ext/kernel_gem.rb:62:in `synchronize'
	from /Users/deivid/Code/rubygems/rubygems/lib/rubygems/core_ext/kernel_gem.rb:62:in `gem'
	from /Users/deivid/Code/rubygems/rubygems/lib/rubygems/commands/exec_command.rb:193:in `activate!'
	from /Users/deivid/Code/rubygems/rubygems/lib/rubygems/commands/exec_command.rb:73:in `execute'
	from /Users/deivid/Code/rubygems/rubygems/lib/rubygems/command.rb:326:in `invoke_with_build_args'
	from /Users/deivid/Code/rubygems/rubygems/lib/rubygems/command_manager.rb:255:in `invoke_command'
	from /Users/deivid/Code/rubygems/rubygems/lib/rubygems/command_manager.rb:194:in `process_args'
	from /Users/deivid/Code/rubygems/rubygems/lib/rubygems/command_manager.rb:152:in `run'
	from /Users/deivid/Code/rubygems/rubygems/lib/rubygems/gem_runner.rb:56:in `run'
	from /Users/deivid/code/rubygems/rubygems/exe/gem:12:in `<main>'
```

Vendoring our own securerandom fixes the issue since that way we avoid
activating the gem internally.
2024-09-03 10:49:13 +09:00
David Rodríguez
24c51e1cbb
Let automatiek convert requires that are indented to require_relative as well 2024-09-03 10:49:13 +09:00
Nobuyoshi Nakada
c1fecc5eab [rubygems/rubygems] Simplify Gem.read_binary and Gem.write_binary
Since `Gem.open_file` no longer locks the target file and is same as
`File.open` now, simply `Gem.read_binary` should read in binary mode.
Also the body of `Gem.write_binary` is same as `File.binwrite`.

44df9045df
2024-09-02 17:28:50 +00:00
Nobuyoshi Nakada
1f00f6a09e [rubygems/rubygems] Avoid another race condition of open mode
Instead, just open in CREATE and APPEND mode.
Also, move the workaround for old Solaris as fallback to retry.

2daad257be
2024-09-02 15:51:10 +00:00
Burdette Lamar
b539b43b2b [ruby/rdoc] [DOC] Fix links (https://github.com/ruby/rdoc/pull/1169)
a576ff890f
2024-09-02 15:36:53 +00:00
tomoya ishida
fe2db1bed9 [ruby/reline] Get console handle again and retry when Win32API call
fails
(https://github.com/ruby/reline/pull/734)

66291b5e3c
2024-09-02 14:34:39 +00:00
David Rodríguez
bb511c3f10 [rubygems/rubygems] Don't try to remove previous install folder if it's empty
Ruby ships with empty directories for default gems. If Ruby
installations has unsafe world-writable permissions, we will complain
when about to install a gem that happens to be also a default gem,
because we'll start by removing the previous install folder and that's
supposed to be insecure due to too loose permissions.

However, if the folder is empty, we don't actually need to remove
anything, so we can skip the whole thing, avoiding the errors.

2f3cd8ac4e
2024-09-02 14:01:15 +00:00
David Rodríguez
b00b0d5f8f [rubygems/rubygems] Improve insecure gem overwrite message
7c71dac22e
2024-09-02 14:01:14 +00:00
Hiroshi SHIBATA
745b4775c5 [ruby/logger] Bump up 1.6.1
bda937b4cc
2024-09-02 02:29:24 +00:00
Hiroshi SHIBATA
4aa3491bd2 Skip RDoc related feature if Gem::RDoc is not available 2024-09-01 20:00:13 +09:00
Durable Programming Team
d6fc8f3d57 [rubygems/rubygems] fix @license typo preventing licenses from being correctly unmarshalled
d6ba7ef79f
2024-08-31 18:30:25 +00:00
Hiroshi SHIBATA
7900128ab2 [ruby/uri] Bump up 0.13.1
31ec9cea66
2024-08-31 05:14:54 +00:00
Mari Imaizumi
a2b3cb65ea [ruby/reline] Implement re-read-init-file
(https://github.com/ruby/reline/pull/740)

59e4ade807
2024-08-31 03:26:50 +00:00
Matt Brictson
830ff66e2c [rubygems/rubygems] Emit progress to stderr when --parseable is passed to bundle outdated
Before, `bundle outdated --parseable` (or `--porcelain`) caused output
to be completely silenced during definition resolution, so nothing was
printed at all until the table of outdated gems was printed.

With this change, `--parseable`/`--porcelain` now prints progress to
stderr during resolution. E.g.:

```
Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...
```

This provides a better user experience, especially when
`outdated --parseable` takes several seconds or more.

The report of outdated gems is still printed to stdout, and the exit
status codes are unchanged, so the fundamental contract with other tools
consuming the `outdated --parseable` result should not be affected.

7d4bb43570
2024-08-30 10:36:08 +00:00
David Rodríguez
08b92b67ff [rubygems/rubygems] Don't blow up when explicit version is removed from some git sources
`version` is actually an attribute of the dependency, not of the git
source. Sometimes it's passed to the git source to be able to fake a
gemspec in case there's no gemspec in the source, but it should not be
used for source comparison.

d936fbd78e
2024-08-30 10:16:29 +00:00
Koichi ITO
af65b41e07 [ruby/prism] Remove deprecated lib/prism/translation/parser/rubocop.rb file
Follow up https://github.com/ruby/prism/pull/2558.

This PR removes deprecated lib/prism/translation/parser/rubocop.rb file.

The file was a workaround to allow setting `TargetRubyVersion: 80_82_73_83_77.xx` until Prism (`Prism::Translation::Parser`) is integrated into RuboCop.
RuboCop already supports Prism (`Prism::Translation::Parser`) as of https://github.com/rubocop/rubocop/pull/12724.

It has been several months since the file was deprecated in ruby/prism#2558.
And, yesterday, Prism 1.0.0 was released, but perhaps the file should have been removed before then.

Although this might be seen as incompatible with semver 1.0.0, I think there is no longer a reason to keep the file.

646a10270e
2024-08-29 20:04:55 +00:00
tomoya ishida
b74e0c5f6b [ruby/reline] Calculate mbchar width with bsearch
(https://github.com/ruby/reline/pull/632)

0851e93640
2024-08-29 17:34:31 +00:00
David Rodríguez
871ba3e9e3 [rubygems/rubygems] Add a note about "platforms" in Gemfile vs "platforms" in Gemfile.lock
0dd4bd59b4
2024-08-29 09:59:26 +00:00
David Rodríguez
6dee0d3fb0 [rubygems/rubygems] Reject unknown platforms when running bundle lock --add-platform
1f93a2bdc5
2024-08-29 09:59:26 +00:00
Kevin Newton
ad737a8d0f
[PRISM] Sync version update 2024-08-28 15:43:32 -04:00
Kevin Newton
45f32e3a50 [ruby/prism] Reverse-sync ruby/ruby and deprecate old fields
bc21c9f3ee
2024-08-28 19:07:16 +00:00
Kevin Newton
417bb8d4fd [PRISM] Field renaming
Rename some fields that do not quite make sense.

* CaseMatchNode#consequent -> CaseMatchNode#else_clause
* CaseNode#consequent -> CaseNode#else_clause
* IfNode#consequent -> IfNode#subsequent
* RescueNode#consequent -> RescueNode#subsequent
* UnlessNode#consequent -> UnlessNode#else_clause
2024-08-28 15:06:53 -04:00
tomoya ishida
ce6b0c4425 [ruby/irb] Colorize command input
(https://github.com/ruby/irb/pull/983)

0e64136e76
2024-08-28 16:16:31 +00:00
Olle Jonsson
b5646124b3 [ruby/timeout] timeout.rb: Update documentation
This is a followup to #49.

683fdb45ee
2024-08-28 10:58:23 +00:00
Stan Lo
87fa75c5db [ruby/irb] Move parse_command method to Context
(https://github.com/ruby/irb/pull/993)

Since Context dictates whether a line is a command or an expression,
moving the parse_command method to Context makes the relationship
more explicit.

9a4487af61
2024-08-27 12:49:23 +00:00
Mari Imaizumi
a431f4ecc4 [ruby/reline] Remove unused variables
(https://github.com/ruby/reline/pull/739)

14784eddee
2024-08-27 12:46:45 +00:00
Hiroshi SHIBATA
04ca75ea69 [ruby/uri] Also warn URI::RFC3986_PARSER.extract
0f6b945557
2024-08-27 02:39:52 +00:00
Hiroshi SHIBATA
e5295644c9 [ruby/fileutils] Update license files same as ruby/ruby
9e32a88573
2024-08-27 00:39:24 +00:00
Stan Lo
ec61dbd98e [ruby/rdoc] Make darkfish more responsive and readable on mobile
devices
(https://github.com/ruby/rdoc/pull/1162)

- Make the sidebar toggle fixed on all devices
- Prevent default zooming on mobile devices
- Improve sidebar opening on mobile devices

95b6cfb64f
2024-08-26 22:02:33 +00:00
Matt Brictson
7c794c287e [rubygems/rubygems] Emit progress to stderr when --print is passed to bundle lock
`bundle lock --print --update` can take a long time to fetch sources and
resolve the lock file.

Before, `--print` caused output to be completely silenced, so nothing
was printed at all until the resolved lock file is finally emitted to
stdout.

With this change, `--print` now prints progress to stderr. E.g.:

```
Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...
```

This provides a better user experience, especially when
`lock --print --update` takes several seconds or more.

The lock file is still printed to stdout, so tools consuming the lock
file on stdout will not be affected.

6719baa700
2024-08-26 14:56:26 +00:00
Matt Brictson
2066482684 [rubygems/rubygems] Fix newline=false being ignored by Shell#warn
e021ff33a8
2024-08-26 14:56:26 +00:00
Matt Brictson
cfad1f95d5 [rubygems/rubygems] Fix missing 'msg' parameter in Shell#no?
ffe89a099a
2024-08-26 14:56:25 +00:00
Nobuyoshi Nakada
136cbf0441 [ruby/tempfile] Support anonymous tempfile on earlier than Ruby 3.2
7052805029
2024-08-26 02:49:02 +00:00
Ufuk Kayserilioglu
519152db6d [ruby/rdoc] Make the summary triangle appear in the correct place
when the summary text overflows to next line.
(https://github.com/ruby/rdoc/pull/1160)

f2eb62f6f8
2024-08-24 18:15:21 +00:00
Stan Lo
6717b69067 [ruby/rdoc] Modernize RDoc Darkfish template CSS
(https://github.com/ruby/rdoc/pull/1157)

- Update color scheme with muted green tones and improved contrast
- Enhance readability by adjusting font sizes and weights
- Improve code block styling with a light gray background
- Refactor layout for better responsiveness and sidebar presentation
- Standardize link styles across the document
- Implement CSS variables for easier theme customization
- Adjust heading styles for better visual hierarchy
- Enhance table and list styling for improved readability
- Optimize search field and navigation toggle appearance
- Improve method detail and documentation section styling
- Reorganize css and overhaul the sidebar design
- Improve code block's syntax highlighting

6cde9edadb
2024-08-24 11:07:28 +00:00
David Rodríguez
9f5860407f [rubygems/rubygems] Fix error message when Bundler refuses to install due to frozen being set without a lockfile
0857d62ca6
2024-08-23 07:00:30 +00:00
Hiroshi SHIBATA
7812732e2c [ruby/tempfile] File.new(fileno, mode: mode, path: path) is provided from Ruby 3.2
67ce897727
2024-08-23 06:07:40 +00:00
David Rodríguez
2569413b1c [rubygems/rubygems] Fix --prefer-local flag
The original implementation of this flag was too naive and all it did
was restricting gems to locally installed versions if there are any
local versions installed.

However, it should be much smarter. For example:

* It should fallback to remote versions if locally installed version
  don't satisfy the requirements.
* It should pick locally installed versions even for subdependencies not
  yet discovered.

This commit fixes both issues by using a smarter approach similar to how
we resolve prereleases:

* First resolve optimistically using only locally installed gems.
* If any conflicts are found, scan those conflicts, allow remote
  versions for the specific gems that run into conflicts, and
  re-resolve.

607a3bf479

Co-authored-by: Gourav Khunger <gouravkhunger18@gmail.com>
2024-08-22 11:48:32 +00:00
David Rodríguez
203051d839 [rubygems/rubygems] Fix bad grammar in log message
bea4c1ad79
2024-08-22 11:48:31 +00:00
David Rodríguez
669d1f79d8 [rubygems/rubygems] Restore support for passing relative paths to :git
The `file://` protocol does not really work with relative paths and it's
not necessary anyways. So restore support for that by not using
`file://`.

16a68998ce
2024-08-21 14:47:57 +00:00