Skip to content

Commit 6fb2bf9

Browse files
hsbtclaude
andcommitted
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. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 4c2cafa commit 6fb2bf9

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

bundler/lib/bundler/definition.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@ class << self
1010
attr_accessor :no_lock
1111
end
1212

13-
attr_writer :lockfile
13+
attr_writer :lockfile, :overrides
1414

1515
attr_reader(
1616
:dependencies,
1717
:locked_checksums,
1818
:locked_deps,
1919
:locked_gems,
20+
:overrides,
2021
:platforms,
2122
:ruby_version,
2223
:lockfile,
@@ -88,6 +89,7 @@ def initialize(lockfile, dependencies, sources, unlock, ruby_version = nil, opti
8889
@specs = nil
8990
@ruby_version = ruby_version
9091
@gemfiles = gemfiles
92+
@overrides = []
9193

9294
@lockfile = lockfile
9395
@lockfile_contents = String.new

spec/bundler/definition_spec.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,24 @@
33
require "bundler/definition"
44

55
RSpec.describe Bundler::Definition do
6+
describe "#overrides" do
7+
before do
8+
allow(Bundler::SharedHelpers).to receive(:find_gemfile) { bundled_app_gemfile }
9+
end
10+
11+
subject { Bundler::Definition.new(bundled_app_lock, [], Bundler::SourceList.new, {}) }
12+
13+
it "defaults to an empty array" do
14+
expect(subject.overrides).to eq([])
15+
end
16+
17+
it "is writable" do
18+
override = Bundler::Override.new("rails", :version, ">= 8.0")
19+
subject.overrides = [override]
20+
expect(subject.overrides).to eq([override])
21+
end
22+
end
23+
624
describe "#lock" do
725
before do
826
allow(Bundler::SharedHelpers).to receive(:find_gemfile) { bundled_app_gemfile }

0 commit comments

Comments
 (0)