diff options
| author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2026-05-01 11:27:22 +0900 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2026-05-07 09:24:49 +0000 |
| commit | bb1b229685cc5acb18f6bba71830bb9df3110fe1 (patch) | |
| tree | d60061fec6d46abe7793f3d677ed9abc59f6e931 | |
| parent | a42a6bc2adca25070706688b3b8247d26160364f (diff) | |
[ruby/rubygems] Add overrides attribute to Bundler::Definition
Reserve a slot on Definition for the upcoming Gemfile `override` DSL.
This commit only stores the data; the DSL entry point and the resolver
hookup come in later commits.
https://github.com/ruby/rubygems/commit/6fb2bf90fe
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
| -rw-r--r-- | lib/bundler/definition.rb | 4 | ||||
| -rw-r--r-- | spec/bundler/bundler/definition_spec.rb | 18 |
2 files changed, 21 insertions, 1 deletions
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb index a620475c18..2435479f94 100644 --- a/lib/bundler/definition.rb +++ b/lib/bundler/definition.rb @@ -10,13 +10,14 @@ module Bundler attr_accessor :no_lock end - attr_writer :lockfile + attr_writer :lockfile, :overrides attr_reader( :dependencies, :locked_checksums, :locked_deps, :locked_gems, + :overrides, :platforms, :ruby_version, :lockfile, @@ -88,6 +89,7 @@ module Bundler @specs = nil @ruby_version = ruby_version @gemfiles = gemfiles + @overrides = [] @lockfile = lockfile @lockfile_contents = String.new diff --git a/spec/bundler/bundler/definition_spec.rb b/spec/bundler/bundler/definition_spec.rb index 8c7d5667ac..8c4a5a0331 100644 --- a/spec/bundler/bundler/definition_spec.rb +++ b/spec/bundler/bundler/definition_spec.rb @@ -3,6 +3,24 @@ require "bundler/definition" RSpec.describe Bundler::Definition do + describe "#overrides" do + before do + allow(Bundler::SharedHelpers).to receive(:find_gemfile) { bundled_app_gemfile } + end + + subject { Bundler::Definition.new(bundled_app_lock, [], Bundler::SourceList.new, {}) } + + it "defaults to an empty array" do + expect(subject.overrides).to eq([]) + end + + it "is writable" do + override = Bundler::Override.new("rails", :version, ">= 8.0") + subject.overrides = [override] + expect(subject.overrides).to eq([override]) + end + end + describe "#lock" do before do allow(Bundler::SharedHelpers).to receive(:find_gemfile) { bundled_app_gemfile } |
