Commit graph

98 commits

Author SHA1 Message Date
David Rodríguez
7dc284189a
[rubygems/rubygems] Load RubyGems extensions in the first place
This is not currently causing any issues, but I think the most correct
thing to do is that Bundler loads the extensions to RubyGems in the
first place, so that they are available from the beginning.

88faa5c7bb
2025-07-14 11:52:13 +09:00
David Rodríguez
efd8b6d201
[rubygems/rubygems] Use explicit receiver when accessing settings
We have a quality spec that parses all code for explicit usages of
`Bundler.settings[<something>`, to detect undocumented settings. So
using `Bundler.settings` consistently will help catching these things.

ce01bb7cc5
2025-07-02 10:34:18 +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
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
Samuel Giddins
c0a1e877b3
Move most of Bundler::GemHelpers to Gem::Platform
This will help centralize wheel platform selection logic eventually

Signed-off-by: Samuel Giddins <segiddins@segiddins.me>
2025-06-06 10:22:18 +09:00
David Rodríguez
976cee57b1 [rubygems/rubygems] Don't fallback to evaluating YAML gemspecs as Ruby code
ca0a7ff8cd
2025-01-20 13:50:25 +09:00
David Rodríguez
e7de621b5a [rubygems/rubygems] Revert RubyGems plugins getting loaded on Bundler.require
These changes were included when adding bundler plugin hooks for
`Bundler.require`, but they seem completely unrelated to that feature,
and have caused several issues.

8d56551dcf
2025-01-16 19:41:12 +09:00
David Rodríguez
c76b1ea2a6 [rubygems/rubygems] Keep track of materializations in the original resolve
This gives more flexibility to allow further improvements.

f11a890f5e
2024-11-26 15:11:05 +09:00
David Rodríguez
4addaaf4df [rubygems/rubygems] More aggressive Performance/FlatMap cop configuration
d8d68cc00e
2024-11-26 15:11:05 +09:00
sodacris
0989400a92 [rubygems/rubygems] fix bundle which commands on windows
9e0018d9fe
2024-11-22 13:36:21 +00:00
David Rodríguez
4d83f37ff7 [rubygems/rubygems] Reduce global state
43c0c41c6b
2024-11-08 12:06:30 +00:00
David Rodríguez
8c184885b0 [rubygems/rubygems] Fix some JRuby warnings when using bundler/setup with Ruby's -w flag
When using the `bundler/setup` entrypoint, Bundler prints the following
warnings in JRuby in `-w` is passed to Ruby.

```
/path/to/bundler/shared_helpers.rb:10: warning: constant Bundler::WINDOWS is deprecated
/path/to/bundler/shared_helpers.rb:11: warning: constant Bundler::FREEBSD is deprecated
/path/to/bundler/lib/bundler/shared_helpers.rb:12: warning: constant Bundler::NULL is deprecated
```

This does not happen in CRuby.

This seems like a JRuby bug but we can skip it by autoloading the
constants.

761ca29fa2
2024-11-06 11:37:10 +00:00
David Rodríguez
cc29d737ef [rubygems/rubygems] Consistently use :create action when creating directories
It gives better errors.

bedae080ef
2024-10-23 08:53:18 +00:00
David Rodríguez
e77346153d [rubygems/rubygems] Remove compatibility code with old RubyGems
f11e42a3c5
2024-10-02 21:33:02 +00:00
David Rodríguez
5000138084
[rubygems/rubygems] Fix bundler/inline resetting ENV
72d8d4dbba
2024-10-02 14:34:55 +09:00
David Rodríguez
a3929a9ca1
[rubygems/rubygems] The BUNDLER_SETUP env should also be cleaned up
47b7e50f64
2024-10-02 14:34:55 +09:00
David Rodríguez
1d768ebd71 [rubygems/rubygems] The dsl_path parameter in DSLError is documented as a string
ab44fa9ee4
2024-09-11 11:28:11 +00:00
David Rodríguez
3e84da0970 [rubygems/rubygems] Auto switch to locked bundler version even when using binstubs
076aba8b1c
2024-06-11 13:30:50 +00:00
David Rodríguez
4f160ad9cf [rubygems/rubygems] Don't let bundle config report a path without a Gemfile as "local app"
6aa2ac337f
2024-05-30 18:23:36 +00:00
Martin Emde
6b0afbb111 [rubygems/rubygems] Reorganize and refactor CompactIndexClient
71bcf354f5
2024-05-25 17:47:07 +00:00
Josh Nichols
6f4f360fc4 [rubygems/rubygems] Add auto_install support to require "bundler/setup"
We have some places that already use `bundle config auto_install true`,
ie:

7a144f3374/bundler/lib/bundler/cli.rb (L11)

This applies the same logic (copy and pasted) to happen when you
`require "bundler/setup"`.

bb3c922341
2024-04-25 18:46:05 +00:00
Hiroshi SHIBATA
acc326b7c4 [rubygems/rubygems] Removed needless class name
a2f43d3756
2024-04-19 05:18:21 +00:00
Hiroshi SHIBATA
a95b46db06 [rubygems/rubygems] Track HEAD changes for old PR proposal
e3d180620c
2024-04-19 05:18:21 +00:00
Hiroshi SHIBATA
0a14fee02f [rubygems/rubygems] Removed redundant begin
a9d22e5f46
2024-04-19 05:18:20 +00:00
fatkodima
09cbbe0e3d [rubygems/rubygems] Add plugin hooks for Bundler.require
b373b7ed0d
2024-04-19 05:18:20 +00:00
David Rodríguez
24d5e7176e
[rubygems/rubygems] Refactor lockfile generation
6a0c03c77f
2024-02-08 14:43:56 +09:00
Samuel Giddins
5a66ea23d2 [rubygems/rubygems] Use mkdir_p helper in bundler.rb
Small refactor, no functional change

5edb7a1026
2023-12-15 15:32:56 +00:00
David Rodríguez
a848c070d2
[rubygems/rubygems] Remove doc not adding much value
c241a88962
2023-12-12 10:04:57 +09:00
David Rodríguez
2755cb1b2f [rubygems/rubygems] Use modern hashes consistently
bb66253f2c
2023-12-07 22:29:33 +00:00
Eric Mueller
6fd3b358ff [rubygems/rubygems] Duplicate Gem::CIDetector into bundler
Because bundler needs to support older versions of rubygems, we can't
actually rely on Gem::CIDetector (yet - in a year or so they might be
able to consolidate, if they don't change futher). So we're copying it
into the Bundler:: namespace, and enforcing that they stay completely in
sync with a test. No other tests are needed, since Gem::CIDetector is
already tested, and this is and will remain identical.

abc67f0da1
2023-12-06 20:05:25 +00:00
Eric Mueller
73440e1ef2 [rubygems/rubygems] Many major_deprecations supply :removed_message
Generally the removed message is very similar, but often it needs to
specify that the feature has "been removed" instead of "will be
removed", or "been deprecated". And a few chunks of text needed more
substantial updates. And a number of them seemed to have been carefully
crafted to make sense in either context, so I left those alone.

8d42cf9104
2023-12-01 17:52:38 +00:00
David Rodríguez
a131ea39b7
[rubygems/rubygems] Better error when having an insecure install folder
e41156e272
2023-11-08 09:04:28 +09:00
Thong Kuah
ad08674d8d
[rubygems/rubygems] Add CHECKSUMS for each gem in lockfile
We lock the checksum for each resolved spec under a new CHECKSUMS
section in the lockfile.

If the locked spec does not resolve for the local platform, we preserve
the locked checksum, similar to how we preserve specs.

Checksum locking only makes sense on install. The compact index
information is only available then.

bde37ca6bf
2023-10-23 13:59:01 +09:00
Samuel Giddins
e52f9bd41e [rubygems/rubygems] Bundler error handling
63b422b71a
2023-09-20 02:03:02 +00:00
Samuel Giddins
fe90e83b48 [rubygems/rubygems] Use safe_load in bundler when available
34d096e38a
2023-09-20 02:03:01 +00:00
Hiroshi SHIBATA
4bbeed6134 Merge RubyGems/Bundler master from 4076391fce5847689bf2ec402b17133fe4e32285 2023-05-30 21:50:07 +09:00
Hiroshi SHIBATA
0ef6e718d9
Merge https://github.com/rubygems/rubygems/pull/6655 manually. 2023-05-10 15:02:29 +09:00
David Rodríguez
c257380965
Revert "Refactor incomplete specs handling"
This reverts commit 69580f8b72f41c58cae57d1ada4db909922b3891.
2023-04-06 13:07:16 +09:00
Josef Šimánek
9cfd8330ca [rubygems/rubygems] Onboard Rubocop Naming/MemoizedInstanceVariableName rule to Bundler.
d768be0c65
2023-03-28 15:25:44 +09:00
David Rodríguez
ebebc90ec2 Refactor incomplete specs handling
Recent bugs fixed made me realize we were relying on state too much
here. We only need to keep incomplete specs to be able to expire them
and retry resolution without them locked. If we use a separate class, we
can do that more transparently and handle them just like we handle
"missing specs".
2023-03-23 17:18:49 +09:00
David Rodríguez
ddc4fd5644 Normalize git sources
Just like gem sources, a "style-only" change, like adding a trailing
slash, should not expire them.
2023-03-17 18:50:55 +09:00
Mercedes Bernard
583137fe56 [rubygems/rubygems] make Bundler.load_marshal private
4909d071d2
2023-02-23 08:50:03 +00:00
Mercedes Bernard
d5994eb436 [rubygems/rubygems] safe marshal gem specs when inflating
5c5d0c5350
2023-02-23 08:50:02 +00:00
Mercedes Bernard
3d5ec8401f [rubygems/rubygems] safe marshal gem versions when fetching Marshal.specs.4.8.gz
23880353c1
2023-02-23 08:50:02 +00:00
Hiroshi SHIBATA
a43f1d90c2 Merge RubyGems and Bundler master
from 0635c1423d
2023-01-10 15:53:07 +09:00
Hiroshi SHIBATA
b7ad60a794 Merge RubyGems/Bundler master
from 72fd3dd209
2022-12-26 15:09:21 +09:00
Hiroshi SHIBATA
f6620037ba Merge RubyGems-3.4.0 and Bundler-2.4.0 2022-12-24 16:57:07 +09:00
Josef Šimánek
f270aa3eda [rubygems/rubygems] Use safe Marshal deserialization for dependency API response. - adds Bundler#safe_load_marshal and Bundler::SAFE_MARSHAL_CLASSES listing safe classes to deserialize
e947c608cc
2022-12-20 13:15:02 +09:00
Nobuyoshi Nakada
e1f42844a0 [rubygems/rubygems] Prefer RbConfig::CONFIG['EXEEXT'] over hardcorded '.exe'
bc84b2d262
2022-12-12 06:00:41 +00:00