From d9469f5f6a1dd8866e893866a19551dd521abb58 Mon Sep 17 00:00:00 2001 From: "Peter H. Boling" Date: Sun, 8 Nov 2026 07:55:38 +0000 Subject: [PATCH] Include gitignore in subgem release profile --- gems/kettle-jem/lib/kettle/jem.rb | 9 +++++++++ .../spec/integration/template_bootstrap_spec.rb | 10 +++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/gems/kettle-jem/lib/kettle/jem.rb b/gems/kettle-jem/lib/kettle/jem.rb index 5e2c9a315..f98085488 100644 --- a/gems/kettle-jem/lib/kettle/jem.rb +++ b/gems/kettle-jem/lib/kettle/jem.rb @@ -289,6 +289,7 @@ class Error < StandardError; end MONOREPO_SUBGEM_TEMPLATE_ENTRIES + [ "Gemfile", "Rakefile", + ".gitignore", ".rspec", ".simplecov", ".yard-lint.yml", @@ -13838,6 +13839,14 @@ def add_monorepo_subgem_file_overrides(content, gemspec_path, profile = MONOREPO " Rakefile:", " strategy: accept_template" ] + if normalize_template_profile(profile) == MONOREPO_SUBGEM_RELEASE_TEMPLATE_PROFILE + override_lines.concat([ + " .gitignore:", + " strategy: merge", + " preference: destination", + " add_template_only_nodes: true" + ]) + end gemspec = gemspec_path.to_s.strip unless gemspec.empty? override_lines.concat([ diff --git a/gems/kettle-jem/spec/integration/template_bootstrap_spec.rb b/gems/kettle-jem/spec/integration/template_bootstrap_spec.rb index 4c993c4ed..50b7b9dec 100644 --- a/gems/kettle-jem/spec/integration/template_bootstrap_spec.rb +++ b/gems/kettle-jem/spec/integration/template_bootstrap_spec.rb @@ -1123,6 +1123,7 @@ expect(config_yaml.dig("templates", "entries")).to include( "Gemfile", "Rakefile", + ".gitignore", ".rspec", ".simplecov", ".yard-lint.yml", @@ -1133,8 +1134,13 @@ "spec/spec_helper.rb", "gemfiles/modular/documentation.gemfile" ) + expect(config_yaml.dig("files", ".gitignore")).to include( + "strategy" => "merge", "preference" => "destination", "add_template_only_nodes" => true + ) expect(config_yaml.dig("files", "tree_haver.gemspec", "strategy")).to eq("merge") + File.write(File.join(root, ".gitignore"), "/custom-artifact/\n") + configure_dependency_conflicts(root, [ {"gem" => "version_gem", "direct" => "tree_haver.gemspec", "modular" => "gemfiles/modular/runtime_heads.gemfile", "action" => "keep_both", "reason" => "The runtime gemspec and HEAD appraisal intentionally share this dependency."} ]) @@ -1143,6 +1149,7 @@ expect(apply.fetch(:changed_files)).to include("Gemfile", ".yard-lint.yml", ".yardopts", ".yardignore", "bin/setup", "spec/README.md") expect(File).to exist(File.join(root, "Rakefile")) expect(File).to exist(File.join(root, "Gemfile")) + expect(File.read(File.join(root, ".gitignore"))).to include("/custom-artifact/", "/coverage/") expect(File.read(File.join(root, ".rspec"))).to include("--exclude-pattern spec/tmp/**/*_spec.rb") expect(File.read(File.join(root, "spec", "README.md"))).to include("stub_env") expect(File.read(File.join(root, "spec", "README.md"))).to include("include_context \"with rake\"") @@ -1156,7 +1163,8 @@ expect(File.read(File.join(root, "gemfiles", "modular", "documentation.gemfile"))).to include('gem "yard-lint"') updated_config = YAML.safe_load_file(File.join(root, ".structuredmerge", "kettle-jem.yml")) expect(updated_config.dig("templates", "profile")).to eq("monorepo-subgem-release") - expect(updated_config.dig("templates", "entries")).to include("Rakefile", ".yard-lint.yml", ".yardopts") + expect(updated_config.dig("templates", "entries")).to include("Rakefile", ".gitignore", ".yard-lint.yml", ".yardopts") + expect(updated_config.dig("files", ".gitignore")).to include("strategy" => "merge", "preference" => "destination") end end