Commit graph

14676 commits

Author SHA1 Message Date
Earlopain
a04555c8ab [ruby/prism] Be more defensive in the parser translator lexer
Generally I have been good about safely accessing the tokens but failed
to properly guard against no tokens in places
where it could theoretically happen through invalid syntax.

I added a test case for one occurance, other changes are theoretical only.

4a3866af19
2025-08-14 15:42:33 +00:00
Ryan Davis
83a2860484 [ruby/resolv] Require rbconfig in resolv.rb
Uses ::RbConfig::CONFIG['host_os']

Found with ruby --disable-gems -e '...'

5a5a81ce98
2025-08-14 03:52:31 +00:00
Nobuyoshi Nakada
f76ce9fd28 [ruby/optparse] Use ~/.config only if $XDG_CONFIG_HOME is unset or empty
2f9c7500a3
2025-08-08 10:39:20 +00:00
pjsk
01ae9e4fb0
[rubygems/rubygems] implement fallback
e09a6ec815
2025-08-06 10:46:46 +09:00
pjsk
720ae3285e
[rubygems/rubygems] make things a bit more testable
29c085f5f5
2025-08-06 10:46:46 +09:00
Frank Olbricht
8691a4ada1
[rubygems/rubygems] Use IMDSv2 for S3 instance credentials
fa1c51ef59
2025-08-06 10:46:46 +09:00
Hiroshi SHIBATA
4d26ccd2af [rubygems/rubygems] Allow to use Gem::Deprecate#rubygems_deprecate and rubygems_deprecate_command without rubygems.rb
4925403686
2025-08-06 06:23:03 +09:00
Hiroshi SHIBATA
052b38a5d9 [rubygems/rubygems] Deprecate Gem::Specification#datadir and will remove it at RG 4.1
e99cdab171
2025-08-06 06:23:02 +09:00
Hiroshi SHIBATA
51f88f9922 [rubygems/rubygems] Added ability for changing deprecated version from only next major
15177de84e
2025-08-06 06:23:02 +09:00
Hiroshi SHIBATA
19336a6392 [rubygems/rubygems] Removed compatibility.rb that file is for Ruby 1.9.
120c174e7f
2025-08-06 06:23:01 +09:00
Aaron Patterson
89d89fa49d When reading from stdin, put a wrapper around the IO object
The purpose of this commit is to fix Bug #21188.  We need to detect when
stdin has run in to an EOF case.  Unfortunately we can't _call_ the eof
function on IO because it will block.

Here is a short script to demonstrate the issue:

```ruby
x = STDIN.gets
puts x
puts x.eof?
```

If you run the script, then type some characters (but _NOT_ a newline),
then hit Ctrl-D twice, it will print the input string.  Unfortunately,
calling `eof?` will try to read from STDIN again causing us to need a
3rd Ctrl-D to exit the program.

Before introducing the EOF callback to Prism, the input loop looked
kind of like this:

```ruby
loop do
  str = STDIN.gets
  process(str)

  if str.nil?
    p :DONE
  end
end
```

Which required 3 Ctrl-D to exit.  If we naively changed it to something
like this:

```ruby
loop do
  str = STDIN.gets
  process(str)

  if STDIN.eof?
    p :DONE
  end
end
```

It would still require 3 Ctrl-D because `eof?` would block.  In this
patch, we're wrapping the IO object, checking the buffer for a newline
and length, and then using that to simulate a non-blocking eof? method.

This commit wraps STDIN and emulates a non-blocking `eof` function.

[Bug #21188]
2025-08-04 12:34:33 -07:00
Nobuyoshi Nakada
deb0240ea0 [ruby/optparse] Expand literal home paths only
Paths in environment variables should already be expanded.
The base name of the program is also not subject to expansion.

181752391c
2025-08-03 13:53:27 +00:00
Justin Collins
885862a853 [ruby/prism] Match RubyParser behavior for -> lambda args
9f55551b09
2025-08-01 16:57:17 +00:00
Justin Collins
d289eb2723 [ruby/prism] RubyParser translation for stabby lambdas with it
c2e372a8d8
2025-08-01 16:57:17 +00:00
Nobuyoshi Nakada
68a03167a5 Suppress maybe-uninitialized warnings 2025-07-31 23:07:08 +09:00
David Rodríguez
e2fbd01714 [rubygems/rubygems] Remove unnecessary endless loop detection
Fixes a TODO now that no reports have been reported in a while.

f10dc84e7b
2025-07-30 11:19:32 +09:00
David Rodríguez
862b30287a [rubygems/rubygems] Bump vendored thor to 1.4.0
8078a747b3
2025-07-30 11:19:30 +09:00
David Rodríguez
e42f1aaa5a [rubygems/rubygems] Fix truffleruby failing to install sorbet-static when there's no lockfile
The generic Ruby platform was getting unconditionally added in
truffleruby, preventing resolution in situations where there's no
generic ruby version (sorbet-static). Instead, the generic platform
should be considered per dependency, not globally.

a96afc5351
2025-07-30 11:19:26 +09:00
David Rodríguez
15e9dc19fb [rubygems/rubygems] Remove JRuby workaround
Original issue was fixed in JRuby 9.3.0.0, which seems old enough for us
to remove the workaround.

d285148d39
2025-07-30 11:19:24 +09:00
David Rodríguez
a0b501effe [rubygems/rubygems] Remove out of date TODO
After digging into git history a bit, I figure this was about unifying
`bundle cache` and `bundle package`, which already happened a while ago.
So remove this TODO since it's now misleading.

5a0b06b84d
2025-07-30 11:19:23 +09:00
Earlopain
026079925c [ruby/prism] Do not use 0 to indicate the latest ruby version to parse
This makes it hard to do version checks against this value. The current version checks work because there are so few possible values at the moment.

As an example, PR 3337 introduces new syntax for ruby 3.5 and uses `PM_OPTIONS_VERSION_LATEST` as its version guard. Because what is considered the latest changes every year, it must later be changed to `parser->version == parser->version == PM_OPTIONS_VERSION_CRUBY_3_5 || parser->version == PM_OPTIONS_VERSION_LATEST`, with one extra version each year.

With this change, the PR can instead write `parser->version >= PM_OPTIONS_VERSION_CRUBY_3_5` which is self-explanatory
and works for future versions.

8318a113ca
2025-07-29 17:17:28 +00:00
Jason Garber
e15f1a71ad [ruby/tsort] Add changelog_uri to gemspec metadata
Adds a link to the GitHub Releases page for this gem consistent with other gems in the Ruby organization. Existing examples include:

- [json](https://github.com/ruby/json/blob/master/json.gemspec)
- [ostruct](https://github.com/ruby/ostruct/blob/master/ostruct.gemspec)

8086bb33bc
2025-07-28 20:14:38 +00:00
Olle Jonsson
d0bb17e079 [ruby/shellwords] shellwords.gemspec: Avoid configuring exe/ directory
This gem does not ship any executables.

7da06b91ff
2025-07-28 13:18:05 +00:00
David Rodríguez
95fdaa5c3b
(Temporarily?) delay path changes and global cache changes
There are several issues with these which I'm not sure I'll have time to
address properly. I prefer to keep our default branch in a releasable
state just in case. Once they are fixed, this can be reverted.
2025-07-28 10:01:58 +09:00
Nobuyoshi Nakada
f8e002a6b7 [ruby/English] Exclude unused files from gem
6bea25038b
2025-07-27 15:18:50 +00:00
Edouard CHIN
da3c47bcfc [rubygems/rubygems] Document missing options from man pages:
- The `bundle plugin uninstall --all` was missing.
- The `bundle plugin install --local-git` was missing due to being
  deprecated. We decided to reintroduce the doc for more clarity.

4da252945c
2025-07-25 11:10:42 +09:00
Martin Emde
80712140af [rubygems/rubygems] Fix spacing in bundle gem newgem.gemspec.tt
The changelog line was generating indented more than it should.

da6109ef5b
2025-07-25 11:10:40 +09:00
David Rodríguez
9f961a4b30 [rubygems/rubygems] Workaround RVM issue when using Bundler <= 2.5.22
Old versions of BUndler need a workaround to support nested `bundle
exec` invocations by overriding `Gem.activate_bin_path`. However,
RubyGems now uses this new `Gem.activate_and_load_bin_path` helper in
binstubs, which is of course not overridden in those Bundler versions
since it didn't exist at the time.

So, include the override here to workaround that.

e5ed95e242
2025-07-22 10:01:28 +09:00
Nobuyoshi Nakada
d21e4e76c4 [ruby/fileutils] Make ln_s forward target_directory to ln_sr
b487f09eed
2025-07-19 15:44:55 +00:00
Nobuyoshi Nakada
f62e9f2b53 [ruby/fileutils] A workaround for RBS
c3abf39e7a
2025-07-19 14:48:29 +00:00
Nobuyoshi Nakada
a116871258 [ruby/fileutils] A workaround for RBS
fde0f0713a
2025-07-19 14:48:29 +00:00
Nobuyoshi Nakada
5a8e87cb2e [ruby/fileutils] Just the parent path of the destination symlink should exist
71225b1b46
2025-07-19 14:09:50 +00:00
Erik Berlin
4431ca5363 [ruby/fileutils] FileUtils.remove_dir checks directory
f0d7fc817b
2025-07-19 13:54:45 +00:00
Nobuyoshi Nakada
3dced7955c [ruby/fileutils] Use shorter symlink by real paths
277f7f2ff8
2025-07-19 13:47:48 +00:00
Nobuyoshi Nakada
de68f22042 [ruby/fileutils] Fix up FileUtils#ln_sr
2836a164ed
2025-07-19 13:47:47 +00:00
Nobuyoshi Nakada
7725442022 [ruby/fileutils] If noop, return before checking the argument
Get rid of failure in rbs.

e44b7b366c
2025-07-18 10:13:30 +00:00
Akihiko Odaki
eeb682c51b [ruby/fileutils] [DOC] Fix optional argument descriptions
Several optional positional arguments were incorrectly denoted as
keyword arguments so correct them.

c25f069f96
2025-07-18 09:25:15 +00:00
Nobuyoshi Nakada
cfe8263f41 [ruby/fileutils] Fix ln_sf with multiple sources and target_directory: false
In this case, an ArgumentError is now raised rather than ignoring the
option, just as GNU coreutils' `ln` would error on the command line.
Fixes https://github.com/ruby/fileutils/pull/128 as well.

4fc578a75f
2025-07-18 09:22:34 +00:00
David Rodríguez
d5f98b9e7e
Set development version to Bundler 2.8.0.dev and RubyGems 3.8.0.dev
Next version for both will be 4.0.0, however, extra work is necessary to
get CI passing against the new major. So for now, I'm bumping just the
minor version.
2025-07-17 11:13:16 +09:00
David Rodríguez
60fca1defc
Cancel --force deprecation in favor of --redownload
I realized `--redownload` is not a good name, because it does not
necessarily redownloads gems. It only forces reinstallation even if gem
is already installed.

So I believe `--force` is actually a better name and the introduction of
`--force` was a misunderstanding of what the `--force` flag did at the
time.

Let's cancel the deprecation of `--force`.

For now the `--redownload` alias is left around until we decide what to
do with it.
2025-07-17 11:10:46 +09:00
David Rodríguez
851a3e7724 [rubygems/rubygems] Restore treating "--" as an unknown platform
Rather than crashing when parsing it.

aa0064e4c7
2025-07-17 11:07:22 +09:00
David Rodríguez
44dd27c430 [rubygems/rubygems] Fix bundle binstub --path=foo not printing a deprecation warning
Like others, it's a remembered option which we are deprecating in favor
of configuration.

801d5dd943
2025-07-17 11:07:14 +09:00
David Rodríguez
19d931b50d [rubygems/rubygems] Fix bundle cache path=foo not printing a deprecation message
0af03eea5d
2025-07-17 11:07:13 +09:00
David Rodríguez
249cf5397f [rubygems/rubygems] Remove unnecessary flag_deprecation method
d1f8e1c4ac
2025-07-17 11:07:12 +09:00
David Rodríguez
c451f478e6 [rubygems/rubygems] Refactor remembered flag deprecation logic
88dd7d2d45
2025-07-17 11:07:11 +09:00
Takashi Kokubun
024ae34e38 [ruby/erb] Version 5.0.2
e8f3e64581
2025-07-15 16:33:00 +00:00
Jean Boussier
03800bff69 Make Pathname#mkpath builtin
[Feature #17473]
2025-07-15 12:57:18 +02:00
Hiroshi SHIBATA
8794406583 Move builtin methods to pathname.rbinc from lib/pathname.rb 2025-07-15 11:17:51 +09:00
Hiroshi SHIBATA
98ea78f347 Make Pathname to embedded class 2025-07-15 11:17:51 +09:00
Nobuyoshi Nakada
8f54b5bb93 [ruby/uri] [DOC] Update old use of URI::Parser
d2a79c6343
2025-07-14 05:11:58 +00:00