Commit graph

3217 commits

Author SHA1 Message Date
David Rodríguez
7f057e13e0
[rubygems/rubygems] Add a verbose setting to enable verbose output for all commands
0aa1be946f
2025-07-02 10:34:19 +09:00
Earlopain
560edfc8f7
[rubygems/rubygems] Fix bundle console printing bug report template on NameError during require
Followup to https://github.com/rubygems/rubygems/pull/8436

It fixed showing the template when requiring a non-existant file but
user code can do much more than just trying to require other code.

I encountered this particular case because of load order issues, where a library wasn't able
to properly require itself when loaded before some other library.

1c910e5afe
2025-07-02 10:34:19 +09:00
David Rodríguez
82692b32c1
[rubygems/rubygems] Log when simulate_version is enabled
Tweak version output and verbose mode to be transparent about Bundler
simulating a different version than the real one.

179354d153
2025-07-02 10:34:18 +09:00
David Rodríguez
0e1ca4962f
[rubygems/rubygems] None of the global options have default so this seems unnecessary
bea87eab0b
2025-07-02 10:34:18 +09:00
David Rodríguez
c6b6b4f52c
[rubygems/rubygems] Remove duplicated spec
66aabcc9f3
2025-07-02 10:34:18 +09:00
David Rodríguez
b5ef0114cd
[rubygems/rubygems] Migrate all remaining specs to run offline
Also removed the helper to install real gems during specs to avoid the
temptation of introducing network stuff again.

a1ab5e319a
2025-07-02 10:34:18 +09:00
David Rodríguez
5386b6568f
[rubygems/rubygems] Verify specs still using realworld gems still pass with latest versions
9da44ade24
2025-07-02 10:34:18 +09:00
David Rodríguez
41c44ff8e6
[rubygems/rubygems] Realworld optparse gem should be no longer necessary
Optparse was vendored a while ago.

d7afd43756
2025-07-02 10:34:18 +09:00
David Rodríguez
fe44e95808
[rubygems/rubygems] Remove possibly incorrect spec
I spent quite a while on this and I have not been able to reproduce or
even understand how the original issue would happen. I also suspect it
never actually reproduced the original problem properly.

Since I'm in the middle of migrating all specs away from touching the
network, I decided to remove it since I can't write an equivalent spec
without being able to understand the original problem.

c9dfa20877
2025-07-02 10:34:18 +09:00
David Rodríguez
66c6709825
[rubygems/rubygems] bundle viz deprecation specs don't actually need the gem installed
The deprecation message is printed regardless.

397999a390
2025-07-02 10:34:18 +09:00
David Rodríguez
e5d1720e06
[rubygems/rubygems] Spec about cleaning default gems executables no longer needs realworld gems
9cf284997b
2025-07-02 10:34:18 +09:00
David Rodríguez
eb979d998a
[rubygems/rubygems] Don't use currently configured value for default branch
1ae8533690
2025-07-02 10:34:18 +09:00
David Rodríguez
b953d1134a
[rubygems/rubygems] Migrate bundle viz specs to run offline
672722cd4d
2025-07-02 10:34:18 +09:00
David Rodríguez
2fd1f4e6d9
[rubygems/rubygems] Logger realworld gem is no longer necessary
6e6288a496
2025-07-02 10:34:18 +09:00
David Rodríguez
669813a48d
[rubygems/rubygems] Realworld tsort gem should be no longer necessary
93d9b97182
2025-07-02 10:34:18 +09:00
David Rodríguez
d8cf0013ef
[rubygems/rubygems] These specs need stringio only for old versions
a44cdf4c21
2025-07-02 10:34:18 +09:00
David Rodríguez
cd742b6be6
[rubygems/rubygems] Simpler glob to find path to rake
852db00169
2025-07-02 10:34:18 +09:00
David Rodríguez
83c403c4d8
[rubygems/rubygems] Rename some helpers to avoid name classes
I plan to introduce a `base_system_gems` helper to actually install gems
from `base_system_gem_path` into system gems but that would collapse
with an existing helper.

714c209e62
2025-07-02 10:34:18 +09:00
David Rodríguez
e1896c1910
[rubygems/rubygems] Lock specs don't need the real rake gem
d795b8fcb4
2025-07-02 10:34:18 +09:00
David Rodríguez
99178c3ebb
[rubygems/rubygems] Migrate bundle add specs to run offline
02de767e14
2025-07-02 10:34:18 +09:00
David Rodríguez
d6bfb73fb6 [rubygems/rubygems] Update some reference to Bundler 3 to Bundler 4
53174e0aa6
2025-06-30 12:56:50 +09:00
Hiroshi SHIBATA
4e3ef1d9b3 [rubygems/rubygems] Added extra examples
a2e4d8299f
2025-06-30 12:56:50 +09:00
Hiroshi SHIBATA
949f125f0f [rubygems/rubygems] Use Bundler.settings[gem.bundle]
b16511598e
2025-06-30 12:56:50 +09:00
Hiroshi SHIBATA
4ef8cb2671 [rubygems/rubygems] Assert stdout message instead of rspec-mock
91d7abe27f
2025-06-30 12:56:50 +09:00
Hiroshi SHIBATA
7e9cbb109f [rubygems/rubygems] Added missing caller for shared_example
ab9b8c2511
2025-06-30 12:56:50 +09:00
Hiroshi SHIBATA
1cb1b15f77 [rubygems/rubygems] Added --bundle option for triggering bundle install automatically after bundle gem
59ac0db26b
2025-06-30 12:56:50 +09:00
David Rodríguez
e6a6a35a06 [rubygems/rubygems] Fix flakies in bundler gem installer specs
After introducing the `simulate_version` setting, that's another call to
`Bundler#Settings#[]` that gets in the middle and makes these specs fail
when run in isolation.

722360e98e
2025-06-30 12:56:50 +09:00
David Rodríguez
0b9181cbbc [rubygems/rubygems] Fix some pending specs filters that are actually for Bundler 5
b42b2e7055
2025-06-30 12:56:50 +09:00
David Rodríguez
9e566141cd [rubygems/rubygems] Remove "double CI" for testing Bundler 4 mode
Since now every functionality that changes in Bundler 4 is under a
setting, we can enable that setting to test the new functionality,
without having to run our full CI twice.

This can actually be seen as increasing coverage, because Bundler 4
functionality will now be tested on Windows, MacOS, or any other
environment where previously "Bundler 4 mode" was not running.

1cb3e009fc
2025-06-30 12:56:50 +09:00
David Rodríguez
bda2d90969 Rewrite specs to not start local dev servers
They cause flakies when different tests start them in parallel, and also
make the specs more complicated.
2025-06-30 12:56:50 +09: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
938ab128a4 [rubygems/rubygems] Remove unnecessary version check
The `inject` command is deprecated, so these specs only run for Bundler
3 and checking this is unnecessary.

c89fb788f8
2025-06-26 08:06:47 +09:00
David Rodríguez
54e51f1fc3 [rubygems/rubygems] Make yet one more update spec independent of running version
07762f6c1f
2025-06-26 08:06:46 +09:00
David Rodríguez
782d8287c3 [rubygems/rubygems] Remove hardcoded version check from one clean spec
9244cca381
2025-06-26 08:06:46 +09:00
David Rodríguez
7e0358e04f [rubygems/rubygems] Make one more update spec independent of running version
dcd8e8210f
2025-06-26 08:06:45 +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
a2fb1d7dca [rubygems/rubygems] Reorganize post bundle message specs to run independently of major version
70c69c45ba
2025-06-26 08:06:42 +09:00
David Rodríguez
4e74f55db7 [rubygems/rubygems] Use nicer indentation
7e959adce6
2025-06-26 08:06:41 +09:00
David Rodríguez
428627ab68 [rubygems/rubygems] Simplify pristine spec to not need checking major version
bd2a170330
2025-06-26 08:06:40 +09:00
David Rodríguez
077dbb8d42 [rubygems/rubygems] Remove unnecessary loading of fileutils from path specs
These specs load artifice before Bundler boots because of their global
rubygems source. Artifice in turn loads `rack`, `rack-test`, and
`tmpdir` which in turn load `fileutils`.

Because of this, a missing `require` of `fileutils` in RubyGems would
not be caught by specs.

Loading artifice is not necessary for most of these specs, so remove the
global source to avoid it.

aad871c997
2025-06-25 22:41:55 +09:00
David Rodríguez
c17d381d67 [rubygems/rubygems] Remove message long gone from the code base from expectations
2eaada3508
2025-06-25 22:41:52 +09:00
Jeremy Evans
3a9c091cf3 Simplify Set#inspect output
As Set is now a core collection class, it should have special inspect
output.  Ideally, inspect output should be suitable to eval, similar
to array and hash (assuming the elements are also suitable to eval):

  set = Set[1, 2, 3]
  eval(set.inspect) == set # should be true

The simplest way to do this is to use the Set[] syntax.

This deliberately does not use any subclass name in the output,
similar to array and hash. It is more important that users know they
are dealing with a set than which subclass:

  Class.new(Set)[]
  # this does: Set[]
  # not: #<Class:0x00000c21c78699e0>[]

This inspect change breaks the power_assert bundled gem tests, so
add power_assert to TEST_BUNDLED_GEMS_ALLOW_FAILURES in the workflows.

Implements [Feature #21389]
2025-06-25 09:21:07 +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
bc6b045153
[rubygems/rubygems] Cleanup now unnecessary RUBYOPT handling
ac83c78635
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
David Rodríguez
6217216be2
[rubygems/rubygems] Use ENV consistently over CLI flags for specs
dafe50f171
2025-06-24 12:10:50 +09:00
David Rodríguez
0a8ed97b32
[rubygems/rubygems] Helper for hax file
8b7ddf8a07
2025-06-24 12:10:50 +09:00
David Rodríguez
c115e3d974
[rubygems/rubygems] bundle exec does not need artifice in general
cb1f19573a
2025-06-24 12:10:50 +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
7c326ee72e [rubygems/rubygems] Remove usage of Bundler::SpecSet#<<
b556167793
2025-06-23 11:06:58 +09:00