From 7606fd016daa1326d245d1261b44dd016fbdef6a Mon Sep 17 00:00:00 2001 From: Jeremy Green Date: Wed, 20 Nov 2024 13:14:38 -0600 Subject: [PATCH 1/2] Allow for comments on key lines in `roles.yml` Previously we were looking for exact matches on certain lines in `roles.yml`, so if you had added a trailing comment we'd end up putting things in the wrong spot. Fixes https://github.com/bullet-train-co/bullet_train/issues/778 --- .../lib/scaffolding/file_manipulator.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bullet_train-super_scaffolding/lib/scaffolding/file_manipulator.rb b/bullet_train-super_scaffolding/lib/scaffolding/file_manipulator.rb index b12351837..f9022c00d 100644 --- a/bullet_train-super_scaffolding/lib/scaffolding/file_manipulator.rb +++ b/bullet_train-super_scaffolding/lib/scaffolding/file_manipulator.rb @@ -50,7 +50,7 @@ def self.add_line_to_yml_file(file, content, location_array) insert_after = 1 lines.each_with_index do |line, index| break if current_needle.nil? - if line.strip == current_needle + ":" + if line.split('#').first.strip == current_needle + ":" current_needle = location_array.shift.to_s insert_after = index current_space = line.match(/\s+/).to_s From 42bdfd7a83448b9f6d9ad9c01b13ba2afbdc5bcd Mon Sep 17 00:00:00 2001 From: Jeremy Green Date: Wed, 20 Nov 2024 13:29:01 -0600 Subject: [PATCH 2/2] linter --- .../lib/scaffolding/file_manipulator.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bullet_train-super_scaffolding/lib/scaffolding/file_manipulator.rb b/bullet_train-super_scaffolding/lib/scaffolding/file_manipulator.rb index f9022c00d..c5fe74a38 100644 --- a/bullet_train-super_scaffolding/lib/scaffolding/file_manipulator.rb +++ b/bullet_train-super_scaffolding/lib/scaffolding/file_manipulator.rb @@ -50,7 +50,7 @@ def self.add_line_to_yml_file(file, content, location_array) insert_after = 1 lines.each_with_index do |line, index| break if current_needle.nil? - if line.split('#').first.strip == current_needle + ":" + if line.split("#").first.strip == current_needle + ":" current_needle = location_array.shift.to_s insert_after = index current_space = line.match(/\s+/).to_s