Skip to content

Commit 828b3c5

Browse files
hsbtclaude
andcommitted
Fix bundler git_spec to find version line dynamically
The files stub line added to to_ruby output shifted line numbers in generated gemspecs, causing the hardcoded spec_lines[5] to overwrite the name attribute instead of the version. Use dynamic index lookup to find the version line regardless of gemspec header format. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent a32f14a commit 828b3c5

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

bundler/spec/update/git_spec.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,8 @@
299299

300300
it "the --source flag updates version of gems that were originally pulled in by the source" do
301301
spec_lines = lib_path("bar/foo.gemspec").read.split("\n")
302-
spec_lines[5] = "s.version = '2.0'"
302+
version_line = spec_lines.index {|l| l.include?("s.version") }
303+
spec_lines[version_line] = "s.version = '2.0'"
303304

304305
update_git "foo", "2.0", path: @git.path do |s|
305306
s.write "foo.gemspec", spec_lines.join("\n")

0 commit comments

Comments
 (0)