Commit graph

14659 commits

Author SHA1 Message Date
Nobuyoshi Nakada
259b0233d8 [ruby/optparse] Fix OptionParser#program_name not to strip suffix unexpectedly
740ffa76c0
2025-06-29 07:52:45 +00:00
kwatch
9fd793e0bd [ruby/optparse] Enhance to support 'Set' object as an enum
(https://github.com/ruby/optparse/pull/76)

* Enhance to support 'Set' object as an enum

* Add test script for '#make_swithc()'

---------

3869000e98

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2025-06-29 07:30:58 +00:00
Nobuyoshi Nakada
dc74f9cb36
Make uplevel suitable as the option to Kernel#warn
Make Gem::BUNDLED_GEMS.uplevel returns `nil` if `require` frame is not
found, for the simplicity.
2025-06-28 22:27:30 +09:00
Nobuyoshi Nakada
baa0500140
Use symbols as level instead of strings 2025-06-28 22:24:20 +09:00
Nobuyoshi Nakada
4b1de7378d [ruby/uri] [DOC] State that uri library is needed to call Kernel#URI
So that the example works as-is.

30212d311e
2025-06-26 01:46:48 +00:00
Nobuyoshi Nakada
4eba511c1b [ruby/uri] Fix a typo
b636e83d99

Co-authored-by: Olle Jonsson <olle.jonsson@gmail.com>
2025-06-26 01:39:20 +00:00
Nobuyoshi Nakada
228cc794f5 [ruby/uri] Use Lo category chars as escaped chars
TruffleRuby does not allow Symbol categories as identifiers.

5531d42375
2025-06-26 01:39:20 +00:00
Nobuyoshi Nakada
42f753d829 [ruby/uri] Escape reserved characters in scheme name
Fix https://github.com/ruby/uri/pull/89

d543c0dafa
2025-06-26 01:39:19 +00:00
David Rodríguez
90085f62fb [rubygems/rubygems] Simulate Bundler 4 in a better way
Overriding the version constant feels too magic and creates a set of
problems. For example, Bundler will lock the simulated version, and that
can cause issues when the lockfile is used under an environment not
simulating Bundler 4 (it will try to auto-install and auto-switch to a
version that does not exist).

On top of that, it can only be configured with an ENV variable which is
not too flexible.

This commit takes a different approach of using a setting, which is
configurable through ENV or `bundle config`, and pass the simulated
version to `Bundler::FeatureFlag`. The real version is still the one set
by `VERSION`, but anything that `Bundler::FeatureFlag` controls will use
the logic of the "simulated version".

In particular, all feature flags and deprecation messages will respect
the simulated version, and this is exactly the set of functionality that
we want users to be able to easily try before releasing it.

8129402193
2025-06-26 08:06:48 +09:00
David Rodríguez
18618810a2 [rubygems/rubygems] Use Gem::Version` methods instead of string splitting
75fed35264
2025-06-26 08:06:44 +09:00
David Rodríguez
f32dbc9bb0 [rubygems/rubygems] Centralize managing major version dependent behavior in FeatureFlag class
7708e5b784
2025-06-26 08:06:44 +09:00
David Rodríguez
168e7fc300 [rubygems/rubygems] Remove redundant receivers
d7b9c4532e
2025-06-26 08:06:43 +09:00
David Rodríguez
a9860b6cb1 [rubygems/rubygems] No need to reset this variable
f96fedf1f1
2025-06-26 08:06:42 +09:00
MSP-Greg
fb2f89d867 [rubygems/rubygems] Add missing require "fileutils" in lib/rubygems/installer.rb
9a9d0e423e
2025-06-25 22:41:49 +09:00
Benoit Daloze
3b602c952d [ruby/timeout] Gracefully handle a call to ensure_timeout_thread_created in a signal handler
* Fixes the issue described in
  https://github.com/ruby/timeout/issues/17#issuecomment-1461498517
  for TruffleRuby and JRuby.
* CRuby is currently unable to use Timeout in a signal handler due to
  https://bugs.ruby-lang.org/issues/19473.

7a48e1c079
2025-06-24 20:41:45 +00:00
Hiroshi SHIBATA
62aa4a6010 [ruby/resolv] v0.6.1
6b57765f8d
2025-06-24 09:32:57 +00:00
Hiroshi SHIBATA
7a5e46cff2
Revert accidentally commit with 96a0c2065a 2025-06-24 12:10:50 +09:00
David Rodríguez
7a297ad2f9
[rubygems/rubygems] Fix Bundler.original_env['GEM_HOME'] when Bundler is trampolined
4c450eb05e
2025-06-24 12:10:50 +09:00
David Rodríguez
32a9f29cc8
[rubygems/rubygems] Remove no longer necessary workarounds for restarts
Since we no longer pass ruby CLI flags in our spec commands, we no
longer need the previous workaround and can get the realworld code
tested.

fd92c855fb
2025-06-24 12:10:50 +09:00
Jean Boussier
96a0c2065a Mark RClass instance that may be namespaced with RCLASS_NAMESPACEABLE 2025-06-23 10:04:58 +01:00
Nicholas La Roux
a1d62a3b1c [rubygems/rubygems] Handle RubyGems installing to custom dir with non-existent parent dirs
4701123601
2025-06-23 11:07:03 +09:00
David Rodríguez
8f009601f9 [rubygems/rubygems] Handle Errno::EADDRNOTAVAIL gracefully
As showed by the unskiped spec, on Windows trying to use the 0.0.0.0
interface raises this error, and it's raised as a generic system error
when trying to create a `bundler.lock` file. Here's is a better place to
handle that.

e32c5a9e5c
2025-06-23 11:07:02 +09:00
David Rodríguez
7fe1fc392e [rubygems/rubygems] Make HTTP_ERRORS list look like FAIL_ERRORS list
bfa6770e39
2025-06-23 11:07:01 +09:00
David Rodríguez
c3bfce512b [rubygems/rubygems] Simplify non retriable errors list
627a7615f2
2025-06-23 11:07:00 +09:00
David Rodríguez
627ca420e9 [rubygems/rubygems] Move HTTP_ERRORS together with the other error constants
57e8ae7aa6
2025-06-23 11:07:00 +09:00
David Rodríguez
746e0d3ef4 [rubygems/rubygems] Deprecate unused Bundler#SpecSet methods
380c95ce05
2025-06-23 11:06:59 +09:00
Hiroshi SHIBATA
c2d5d2969a [ruby/weakref] v0.1.4
f6bd03ed54
2025-06-19 01:53:19 +00:00
David Rodríguez
441f18df52
Skip to Bundler 4 directly 2025-06-19 10:23:36 +09:00
Landon Grindheim
471da0f0bd
[rubygems/rubygems] Use persist-credentials: false in template
`actions/checkout` defaults this value to `true`, causing credentials to
be written to `.git/config`. By setting it to `false`, we lessen the
likelihood of secrets being written to disk.

a751d36456
2025-06-19 10:23:36 +09:00
David Rodríguez
6d8460e0a0
[rubygems/rubygems] Fix running gem commands in a bundle exec context
They should only load plugins from gems in the bundle.

a229507820
2025-06-19 10:23:36 +09:00
David Rodríguez
4281b95e53
[rubygems/rubygems] Move finding eigenclass to a method
5ad0737e77
2025-06-19 10:23:36 +09:00
David Rodríguez
382b8eadae
[rubygems/rubygems] Fix grammar in bundle config deprecation message
d23b3d61ac
2025-06-19 10:23:36 +09:00
David Rodríguez
4245d522b2
[rubygems/rubygems] Allow enabling "Bundler 3 mode" more easily
Currently to test Bundler 3 mode we have to actually edit the version
file to simulate we're running a future version. This is inconvenient.

Instead, allow passing an environment variable, `BUNDLER_3_MODE`, to set
the "working mode" Bundler should use.

This can now be set easily by end users to enable them to try out the
changes in the future version and give us feedback.

It's unclear how version auto-switching should work when this
environment variable is set, so the auto-switching feature will be
disabled in that case.

4e92e9b209
2025-06-19 10:23:36 +09:00
David Rodríguez
af0b184e83
[rubygems/rubygems] Never ignore gems from path sources during activation
The "ignore" attribute is a RubyGems thing to mark when a installed gem
should be ignored for activation because its extensions are not properly
compiled.

In the case of gems from path sources, the warning is not accurate
because extensions are compiled into the local lib path, which is not
where RubyGems leaves its sentinel `gem.build_complete` file.

Also, there's a single version of each gem in the path source available
to Bundler, so we always certainly want to consider that for activation
and never makes sense to ignore it.

ec5d33695e
2025-06-19 10:23:36 +09:00
Nobuyoshi Nakada
9647dca143 [ruby/tempfile] [DOC] Fix a typo
ruby/ruby#13636

366d9ccb8f

Co-Authored-By: Tim Smith <tsmith84@gmail.com>
2025-06-17 09:41:45 +00:00
David Rodríguez
0a62e82ac4
[rubygems/rubygems] Fix gem install sometimes compiling the wrong source files
If a previous copy of a gem is already installed, RubyGems will not
reinstall the gem but only recompile its extensions. This seems like a
good idea, but only if the gem is being installed from the registry.

If we are installing a locally built package, then the package should be
completely reinstalled and extensions compiled from the sources in the
locally built package, not from the sources in the previous
installation.

1c282d98d5
2025-06-17 15:09:34 +09:00
David Rodríguez
ddb412f680 [rubygems/rubygems] Fix redefinition warnings when using modern RubyGems with old Bundler
ce7e8e92ca
2025-06-16 10:03:36 +09:00
Cody Cutrer
22a7f6b6c2 [rubygems/rubygems] Recognize JRuby loaded from a classloader, not just any JAR
Such is the case if you embed JRuby into an application dynamically (such
as via OSGi). From my test environment:

```
irb(main):006:0> $LOADED_FEATURES.grep(/cli.rb/)
=> ["uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/bundler/cli.rb"]
```

75ac5d46a7
2025-06-13 12:55:14 +09:00
Samuel Giddins
73532ecf3a [rubygems/rubygems] Update bundled tls certs
By running tool/update_bundled_ca_certificates.rb

Signed-off-by: Samuel Giddins <segiddins@segiddins.me>

54f5278450
2025-06-13 12:55:13 +09:00
Hiroshi SHIBATA
166ff187bd [rubygems/rubygems] Removed ccache or sccache from args of Rust builder
```
 "  = note: some arguments are omitted. use `--verbose` to show all linker arguments\n" +
 "  = note: error: unexpected argument '-W' found\n" +
 "          \n" +
 "            tip: to pass '-W' as a value, use '-- -W'\n" +
 "          \n" +
 "          Usage: sccache [OPTIONS] <--dist-auth|--debug-preprocessor-cache|--dist-status|--show-stats|--show-adv-stats|--start-server|--stop-server|--zero-stats|--package-toolchain <EXE> <OUT>|CMD>\n" +
 "          \n" +
 "          For more information, try '--help'.\n" +
 "          \n" +
```

45e688ae62
2025-06-12 14:28:43 +09:00
Joshua Young
8abb87b9c7 [rubygems/rubygems] Remove duplicate documentation for --changelog flag
9f1d07685f
2025-06-12 08:40:51 +09:00
David Rodríguez
3fdaa6a19c [rubygems/rubygems] Fix typos in some documentation lists making them render incorrectly
19739ba71c
2025-06-12 08:40:50 +09:00
David Rodríguez
ca7bd59794 [rubygems/rubygems] Update man pages month
3e4687616a
2025-06-12 08:40:50 +09:00
Earlopain
970813d982 [ruby/prism] Fix parser translator during string escaping with invalid utf-8
Instead, prefer `scan_byte` over `get_byte` since that already returns the byte as an integer, sidestepping conversion issues.

Fixes https://github.com/ruby/prism/issues/3582

7f3008b2b5
2025-06-11 18:07:43 +00:00
Nobuyoshi Nakada
51118fa2da [ruby/net-http] Support pretty_print
bfc60454f6
2025-06-11 05:04:16 +00:00
Hiroshi SHIBATA
51b70d106a [ruby/net-http] Don't set content type by default
Fixes https://github.com/ruby/net-http/issues/205

002441da1e
2025-06-11 03:35:11 +00:00
David Rodríguez
dba72134de [rubygems/rubygems] Fix gem pristine sometimes not resetting extensions
If `gem pristine foo` is run, and there's a default copy of foo, only
executables for it are reset. However, that was causing other copies of
`foo` to only reset executables, which is unexpected.

We should not modify `options[:only_executables]`, but respect its value
for every gem, and make sure special handling for default gems does not
leak to other gems.

2c3039f1b0
2025-06-11 08:48:57 +09:00
Samuel Giddins
7e3d271f76 [rubygems/rubygems] Install the best matching gem for the current platform in gem install
Instead of picking essentially a random matching platform

Signed-off-by: Samuel Giddins <segiddins@segiddins.me>

3727096297
2025-06-11 08:48:56 +09:00
Randy Stauner
b5beb19825 [rubygems/rubygems] Validate dependencies when doing bundle install
b0983f392f
2025-06-11 08:48:55 +09:00
David Rodríguez
ca1c46d33c [rubygems/rubygems] Ignore local specifications if they have incorrect dependencies
Currently ruby-dev installs an incorrect gemspec for rdoc, that does not
declare its dependency on psych.

This seems like a ruby-core bug, but it seems best for Bundler to ignore
it, go with the remote specification instead, and print a warning.

227cafd657
2025-06-06 10:22:29 +09:00