kettle-dev 1.1.11 → 1.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/.envrc +1 -1
- data/CHANGELOG.md +12 -1
- data/README.md +1 -1
- data/README.md.example +1 -1
- data/Rakefile.example +1 -1
- data/gemfiles/modular/injected.gemfile +1 -1
- data/lib/kettle/dev/modular_gemfiles.rb +110 -0
- data/lib/kettle/dev/setup_cli.rb +153 -0
- data/lib/kettle/dev/tasks/template_task.rb +7 -85
- data/lib/kettle/dev/version.rb +1 -1
- data/lib/kettle/dev.rb +1 -0
- data/sig/kettle/dev/modular_gemfiles.rbs +12 -0
- data.tar.gz.sig +0 -0
- metadata +6 -4
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28d4d222b4d85b17a9392755d884f8f0bf0e2193140bc4a5264f54fbf55448e0
|
4
|
+
data.tar.gz: 1495e5a4b252b2b6537727725165dfdb67211c70f078d5b293a3ce912038983c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5861e1d242db51b88b9625e4dfcd09bb598b57ae25b505f3e3674d0a250b325133b2cae2644e111d9db649f690d5f94a31cebfc098a19bfd0d4aeba5f9efebbe
|
7
|
+
data.tar.gz: 78c1003a70069e48e768dbec76298b50a8a2207419a27d398b0ab8fef89e31cfb64d9564ed9fa3c52ca4840c982298885ce1ead3426db4e50e82e251865010c8
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/.envrc
CHANGED
@@ -21,7 +21,7 @@ export K_SOUP_COV_DO=true # Means you want code coverage
|
|
21
21
|
export K_SOUP_COV_COMMAND_NAME="Test Coverage"
|
22
22
|
# Available formats are html, xml, rcov, lcov, json, tty
|
23
23
|
export K_SOUP_COV_FORMATTERS="html,xml,rcov,lcov,json,tty"
|
24
|
-
export K_SOUP_COV_MIN_BRANCH=
|
24
|
+
export K_SOUP_COV_MIN_BRANCH=80 # Means you want to enforce X% branch coverage
|
25
25
|
export K_SOUP_COV_MIN_LINE=96 # Means you want to enforce X% line coverage
|
26
26
|
export K_SOUP_COV_MIN_HARD=true # Means you want the build to fail if the coverage thresholds are not met
|
27
27
|
export K_SOUP_COV_MULTI_FORMATTERS=true
|
data/CHANGELOG.md
CHANGED
@@ -24,6 +24,15 @@ Please file a bug if you notice a violation of semantic versioning.
|
|
24
24
|
### Fixed
|
25
25
|
### Security
|
26
26
|
|
27
|
+
## [1.1.12] - 2025-09-09
|
28
|
+
- TAG: [v1.1.12][1.1.12t]
|
29
|
+
- COVERAGE: 94.84% -- 3422/3608 lines in 25 files
|
30
|
+
- BRANCH COVERAGE: 78.97% -- 1386/1755 branches in 25 files
|
31
|
+
- 76.88% documented
|
32
|
+
### Changed
|
33
|
+
- improve Gemfile updates during kettle-dev-setup
|
34
|
+
- git origin-based funding_org derivation during setup
|
35
|
+
|
27
36
|
## [1.1.11] - 2025-09-08
|
28
37
|
- TAG: [v1.1.11][1.1.11t]
|
29
38
|
- COVERAGE: 96.56% -- 3396/3517 lines in 24 files
|
@@ -581,7 +590,9 @@ Please file a bug if you notice a violation of semantic versioning.
|
|
581
590
|
- Selecting will run the selected workflow via `act`
|
582
591
|
- This may move to its own gem in the future.
|
583
592
|
|
584
|
-
[Unreleased]: https://github.com/kettle-rb/kettle-dev/compare/v1.1.
|
593
|
+
[Unreleased]: https://github.com/kettle-rb/kettle-dev/compare/v1.1.12...HEAD
|
594
|
+
[1.1.12]: https://github.com/kettle-rb/kettle-dev/compare/v1.1.11...v1.1.12
|
595
|
+
[1.1.12t]: https://github.com/kettle-rb/kettle-dev/releases/tag/v1.1.12
|
585
596
|
[1.1.11]: https://github.com/kettle-rb/kettle-dev/compare/v1.1.10...v1.1.11
|
586
597
|
[1.1.11t]: https://github.com/kettle-rb/kettle-dev/releases/tag/v1.1.11
|
587
598
|
[1.1.10]: https://github.com/kettle-rb/kettle-dev/compare/v1.1.9...v1.1.10
|
data/README.md
CHANGED
@@ -907,7 +907,7 @@ Thanks for RTFM. ☺️
|
|
907
907
|
[📌gitmoji]:https://gitmoji.dev
|
908
908
|
[📌gitmoji-img]:https://img.shields.io/badge/gitmoji_commits-%20%F0%9F%98%9C%20%F0%9F%98%8D-34495e.svg?style=flat-square
|
909
909
|
[🧮kloc]: https://www.youtube.com/watch?v=dQw4w9WgXcQ
|
910
|
-
[🧮kloc-img]: https://img.shields.io/badge/KLOC-3.
|
910
|
+
[🧮kloc-img]: https://img.shields.io/badge/KLOC-3.608-FFDD67.svg?style=for-the-badge&logo=YouTube&logoColor=blue
|
911
911
|
[🔐security]: SECURITY.md
|
912
912
|
[🔐security-img]: https://img.shields.io/badge/security-policy-259D6C.svg?style=flat
|
913
913
|
[📄copyright-notice-explainer]: https://opensource.stackexchange.com/questions/5778/why-do-licenses-such-as-the-mit-license-specify-a-single-year
|
data/README.md.example
CHANGED
@@ -507,7 +507,7 @@ Thanks for RTFM. ☺️
|
|
507
507
|
[📌gitmoji]:https://gitmoji.dev
|
508
508
|
[📌gitmoji-img]:https://img.shields.io/badge/gitmoji_commits-%20%F0%9F%98%9C%20%F0%9F%98%8D-34495e.svg?style=flat-square
|
509
509
|
[🧮kloc]: https://www.youtube.com/watch?v=dQw4w9WgXcQ
|
510
|
-
[🧮kloc-img]: https://img.shields.io/badge/KLOC-3.
|
510
|
+
[🧮kloc-img]: https://img.shields.io/badge/KLOC-3.608-FFDD67.svg?style=for-the-badge&logo=YouTube&logoColor=blue
|
511
511
|
[🔐security]: SECURITY.md
|
512
512
|
[🔐security-img]: https://img.shields.io/badge/security-policy-259D6C.svg?style=flat
|
513
513
|
[📄copyright-notice-explainer]: https://opensource.stackexchange.com/questions/5778/why-do-licenses-such-as-the-mit-license-specify-a-single-year
|
data/Rakefile.example
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# visibility and discoverability on RubyGems.org.
|
3
3
|
# However, this gem sits underneath all my other gems, and also "depends on" many of them.
|
4
4
|
# So instead of depending on them directly it injects them into the other gem's gemspec on install.
|
5
|
-
# This gem its injected dev dependencies, will install on Ruby down to 2.3.x.
|
5
|
+
# This gem, and its injected dev dependencies, will install on Ruby down to 2.3.x.
|
6
6
|
# This gem does not inject runtime dependencies.
|
7
7
|
# Thus, dev dependencies injected into gemspecs must have
|
8
8
|
#
|
@@ -0,0 +1,110 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Kettle
|
4
|
+
module Dev
|
5
|
+
# Utilities for copying modular Gemfiles and related directories
|
6
|
+
# in a DRY fashion. Used by both the template rake task and the
|
7
|
+
# setup CLI to ensure gemfiles/modular/* are present before use.
|
8
|
+
module ModularGemfiles
|
9
|
+
MODULAR_GEMFILE_DIR = "gemfiles/modular"
|
10
|
+
|
11
|
+
module_function
|
12
|
+
|
13
|
+
# Copy the modular gemfiles and nested directories from the gem
|
14
|
+
# checkout into the target project, prompting where appropriate
|
15
|
+
# via the provided helpers.
|
16
|
+
#
|
17
|
+
# @param helpers [Kettle::Dev::TemplateHelpers] helper API
|
18
|
+
# @param project_root [String] destination project root
|
19
|
+
# @param gem_checkout_root [String] kettle-dev checkout root (source)
|
20
|
+
# @param min_ruby [Gem::Version, nil] minimum Ruby version (for style.gemfile tuning)
|
21
|
+
# @return [void]
|
22
|
+
def sync!(helpers:, project_root:, gem_checkout_root:, min_ruby: nil)
|
23
|
+
# 4a) gemfiles/modular/*.gemfile except style.gemfile (handled below)
|
24
|
+
modular_gemfiles = %w[
|
25
|
+
coverage
|
26
|
+
debug
|
27
|
+
documentation
|
28
|
+
injected
|
29
|
+
optional
|
30
|
+
runtime_heads
|
31
|
+
x_std_libs
|
32
|
+
]
|
33
|
+
modular_gemfiles.each do |base|
|
34
|
+
modular_gemfile = "#{base}.gemfile"
|
35
|
+
src = helpers.prefer_example(File.join(gem_checkout_root, MODULAR_GEMFILE_DIR, modular_gemfile))
|
36
|
+
dest = File.join(project_root, MODULAR_GEMFILE_DIR, modular_gemfile)
|
37
|
+
helpers.copy_file_with_prompt(src, dest, allow_create: true, allow_replace: true)
|
38
|
+
end
|
39
|
+
|
40
|
+
# 4b) gemfiles/modular/style.gemfile with dynamic rubocop constraints
|
41
|
+
modular_gemfile = "style.gemfile"
|
42
|
+
src = helpers.prefer_example(File.join(gem_checkout_root, MODULAR_GEMFILE_DIR, modular_gemfile))
|
43
|
+
dest = File.join(project_root, MODULAR_GEMFILE_DIR, modular_gemfile)
|
44
|
+
if File.basename(src).sub(/\.example\z/, "") == "style.gemfile"
|
45
|
+
helpers.copy_file_with_prompt(src, dest, allow_create: true, allow_replace: true) do |content|
|
46
|
+
# Adjust rubocop-lts constraint based on min_ruby
|
47
|
+
version_map = [
|
48
|
+
[Gem::Version.new("1.8"), "~> 0.1"],
|
49
|
+
[Gem::Version.new("1.9"), "~> 2.0"],
|
50
|
+
[Gem::Version.new("2.0"), "~> 4.0"],
|
51
|
+
[Gem::Version.new("2.1"), "~> 6.0"],
|
52
|
+
[Gem::Version.new("2.2"), "~> 8.0"],
|
53
|
+
[Gem::Version.new("2.3"), "~> 10.0"],
|
54
|
+
[Gem::Version.new("2.4"), "~> 12.0"],
|
55
|
+
[Gem::Version.new("2.5"), "~> 14.0"],
|
56
|
+
[Gem::Version.new("2.6"), "~> 16.0"],
|
57
|
+
[Gem::Version.new("2.7"), "~> 18.0"],
|
58
|
+
[Gem::Version.new("3.0"), "~> 20.0"],
|
59
|
+
[Gem::Version.new("3.1"), "~> 22.0"],
|
60
|
+
[Gem::Version.new("3.2"), "~> 24.0"],
|
61
|
+
[Gem::Version.new("3.3"), "~> 26.0"],
|
62
|
+
[Gem::Version.new("3.4"), "~> 28.0"],
|
63
|
+
]
|
64
|
+
new_constraint = nil
|
65
|
+
rubocop_ruby_gem_version = nil
|
66
|
+
ruby1_8 = version_map.first
|
67
|
+
begin
|
68
|
+
if min_ruby
|
69
|
+
version_map.reverse_each do |min, req|
|
70
|
+
if min_ruby >= min
|
71
|
+
new_constraint = req
|
72
|
+
rubocop_ruby_gem_version = min.segments.join("_")
|
73
|
+
break
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
if !new_constraint || !rubocop_ruby_gem_version
|
78
|
+
# A gem with no declared minimum ruby is effectively >= 1.8.7
|
79
|
+
new_constraint = ruby1_8[1]
|
80
|
+
rubocop_ruby_gem_version = ruby1_8[0].segments.join("_")
|
81
|
+
end
|
82
|
+
rescue StandardError => e
|
83
|
+
Kettle::Dev.debug_error(e, __method__) if defined?(Kettle::Dev.debug_error)
|
84
|
+
# ignore, use default
|
85
|
+
ensure
|
86
|
+
new_constraint ||= ruby1_8[1]
|
87
|
+
rubocop_ruby_gem_version ||= ruby1_8[0].segments.join("_")
|
88
|
+
end
|
89
|
+
if new_constraint && rubocop_ruby_gem_version
|
90
|
+
token = "{RUBOCOP|LTS|CONSTRAINT}"
|
91
|
+
content.gsub!(token, new_constraint) if content.include?(token)
|
92
|
+
token = "{RUBOCOP|RUBY|GEM}"
|
93
|
+
content.gsub!(token, "rubocop-ruby#{rubocop_ruby_gem_version}") if content.include?(token)
|
94
|
+
end
|
95
|
+
content
|
96
|
+
end
|
97
|
+
else
|
98
|
+
helpers.copy_file_with_prompt(src, dest, allow_create: true, allow_replace: true)
|
99
|
+
end
|
100
|
+
|
101
|
+
# 4c) Copy modular directories with nested/versioned files
|
102
|
+
%w[erb mutex_m stringio x_std_libs].each do |dir|
|
103
|
+
src_dir = File.join(gem_checkout_root, MODULAR_GEMFILE_DIR, dir)
|
104
|
+
dest_dir = File.join(project_root, MODULAR_GEMFILE_DIR, dir)
|
105
|
+
helpers.copy_dir_with_prompt(src_dir, dest_dir)
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
data/lib/kettle/dev/setup_cli.rb
CHANGED
@@ -31,6 +31,8 @@ module Kettle
|
|
31
31
|
say("Starting kettle-dev setup…")
|
32
32
|
prechecks!
|
33
33
|
ensure_dev_deps!
|
34
|
+
ensure_gemfile_from_example!
|
35
|
+
ensure_modular_gemfiles!
|
34
36
|
ensure_bin_setup!
|
35
37
|
ensure_rakefile!
|
36
38
|
run_bin_setup!
|
@@ -47,6 +49,59 @@ module Kettle
|
|
47
49
|
$stderr.puts("[kettle-dev-setup] DEBUG: #{msg}")
|
48
50
|
end
|
49
51
|
|
52
|
+
# Attempt to derive a funding organization from the git remote 'origin' when
|
53
|
+
# not explicitly provided via env or .opencollective.yml.
|
54
|
+
# This is a soft helper that only sets ENV["FUNDING_ORG"] if a plausible
|
55
|
+
# GitHub org can be parsed from the origin URL.
|
56
|
+
# @return [void]
|
57
|
+
def derive_funding_org_from_git_if_missing!
|
58
|
+
# Respect explicit bypass
|
59
|
+
env_val = ENV["FUNDING_ORG"]
|
60
|
+
return if env_val && env_val.to_s.strip.casecmp("false").zero?
|
61
|
+
|
62
|
+
# If already provided via env, do nothing
|
63
|
+
return if ENV["FUNDING_ORG"].to_s.strip != ""
|
64
|
+
return if ENV["OPENCOLLECTIVE_HANDLE"].to_s.strip != ""
|
65
|
+
|
66
|
+
# If project provides an .opencollective.yml with org, do nothing
|
67
|
+
begin
|
68
|
+
oc_path = File.join(Dir.pwd, ".opencollective.yml")
|
69
|
+
if File.file?(oc_path)
|
70
|
+
txt = File.read(oc_path)
|
71
|
+
return if txt =~ /\borg:\s*([\w\-]+)/i
|
72
|
+
end
|
73
|
+
rescue StandardError => e
|
74
|
+
debug("Reading .opencollective.yml failed: #{e.class}: #{e.message}")
|
75
|
+
end
|
76
|
+
|
77
|
+
# Attempt to get origin URL and parse GitHub org
|
78
|
+
begin
|
79
|
+
ga = Kettle::Dev::GitAdapter.new
|
80
|
+
origin_url = nil
|
81
|
+
origin_url = ga.remote_url("origin") if ga.respond_to?(:remote_url)
|
82
|
+
if origin_url.nil? && ga.respond_to?(:remotes_with_urls)
|
83
|
+
begin
|
84
|
+
urls = ga.remotes_with_urls
|
85
|
+
origin_url = urls["origin"] if urls
|
86
|
+
rescue StandardError => e
|
87
|
+
# graceful fallback if adapter backend errs; keep silent behavior
|
88
|
+
debug("remotes_with_urls failed: #{e.class}: #{e.message}")
|
89
|
+
end
|
90
|
+
end
|
91
|
+
origin_url = origin_url.to_s.strip
|
92
|
+
if (m = origin_url.match(%r{github\.com[/:]([^/]+)/}i))
|
93
|
+
org = m[1].to_s
|
94
|
+
if !org.empty?
|
95
|
+
ENV["FUNDING_ORG"] = org
|
96
|
+
debug("Derived FUNDING_ORG from git origin: #{org}")
|
97
|
+
end
|
98
|
+
end
|
99
|
+
rescue StandardError => e
|
100
|
+
# Be silent; this is a best-effort and shouldn't fail setup
|
101
|
+
debug("Could not derive funding org from git: #{e.class}: #{e.message}")
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
50
105
|
def parse!
|
51
106
|
parser = OptionParser.new do |opts|
|
52
107
|
opts.banner = "Usage: kettle-dev-setup [options]"
|
@@ -110,6 +165,9 @@ module Kettle
|
|
110
165
|
|
111
166
|
# Gemfile
|
112
167
|
abort!("No Gemfile found; bundler is required.") unless File.exist?("Gemfile")
|
168
|
+
|
169
|
+
# Seed FUNDING_ORG from git remote origin org when not provided elsewhere
|
170
|
+
derive_funding_org_from_git_if_missing!
|
113
171
|
end
|
114
172
|
|
115
173
|
# 3. Sync dev dependencies from this gem's example gemspec into target gemspec
|
@@ -181,6 +239,101 @@ module Kettle
|
|
181
239
|
say("Copied bin/setup.")
|
182
240
|
end
|
183
241
|
|
242
|
+
# 3b. Ensure Gemfile contains required lines from example without duplicating directives
|
243
|
+
# - Copies source, git_source, gemspec, and eval_gemfile lines that are missing
|
244
|
+
# - Idempotent (running multiple times does not duplicate entries)
|
245
|
+
def ensure_gemfile_from_example!
|
246
|
+
source_path = installed_path("Gemfile.example")
|
247
|
+
abort!("Internal error: Gemfile.example not found within installed gem.") unless source_path && File.exist?(source_path)
|
248
|
+
|
249
|
+
example = File.read(source_path)
|
250
|
+
target_path = "Gemfile"
|
251
|
+
target = File.exist?(target_path) ? File.read(target_path) : ""
|
252
|
+
|
253
|
+
# Extract interesting lines from example
|
254
|
+
ex_sources = []
|
255
|
+
ex_git_sources = [] # names (e.g., :github)
|
256
|
+
ex_git_source_lines = {}
|
257
|
+
ex_has_gemspec = false
|
258
|
+
ex_eval_paths = []
|
259
|
+
|
260
|
+
example.each_line do |ln|
|
261
|
+
s = ln.strip
|
262
|
+
next if s.empty?
|
263
|
+
if s.start_with?("source ")
|
264
|
+
ex_sources << ln.rstrip
|
265
|
+
elsif (m = s.match(/^git_source\(\s*:(\w+)\s*\)/))
|
266
|
+
name = m[1]
|
267
|
+
ex_git_sources << name
|
268
|
+
ex_git_source_lines[name] = ln.rstrip
|
269
|
+
elsif s.start_with?("gemspec")
|
270
|
+
ex_has_gemspec = true
|
271
|
+
elsif (m = s.match(/^eval_gemfile\s+["']([^"']+)["']/))
|
272
|
+
ex_eval_paths << m[1]
|
273
|
+
end
|
274
|
+
end
|
275
|
+
|
276
|
+
# Scan target for presence
|
277
|
+
tg_sources = target.each_line.map(&:rstrip).select { |l| l.strip.start_with?("source ") }
|
278
|
+
tg_git_sources = {}
|
279
|
+
target.each_line do |ln|
|
280
|
+
if (m = ln.strip.match(/^git_source\(\s*:(\w+)\s*\)/))
|
281
|
+
tg_git_sources[m[1]] = true
|
282
|
+
end
|
283
|
+
end
|
284
|
+
tg_has_gemspec = !!target.each_line.find { |l| l.strip.start_with?("gemspec") }
|
285
|
+
tg_eval_paths = target.each_line.map do |ln|
|
286
|
+
if (m = ln.strip.match(/^eval_gemfile\s+["']([^"']+)["']/))
|
287
|
+
m[1]
|
288
|
+
end
|
289
|
+
end.compact
|
290
|
+
|
291
|
+
additions = []
|
292
|
+
# Add missing sources (exact line match)
|
293
|
+
ex_sources.each do |src_line|
|
294
|
+
additions << src_line unless tg_sources.include?(src_line)
|
295
|
+
end
|
296
|
+
# Add missing git_source by name
|
297
|
+
ex_git_sources.each do |name|
|
298
|
+
additions << ex_git_source_lines[name] unless tg_git_sources[name]
|
299
|
+
end
|
300
|
+
# Add gemspec if example has it and target lacks it
|
301
|
+
additions << "gemspec" if ex_has_gemspec && !tg_has_gemspec
|
302
|
+
# Add missing eval_gemfile paths (recreate the exact example line when possible)
|
303
|
+
ex_eval_paths.each do |path|
|
304
|
+
next if tg_eval_paths.include?(path)
|
305
|
+
additions << "eval_gemfile \"#{path}\""
|
306
|
+
end
|
307
|
+
|
308
|
+
return say("Gemfile already contains required entries from example.") if additions.empty?
|
309
|
+
|
310
|
+
# Ensure file ends with a newline
|
311
|
+
target << "\n" unless target.end_with?("\n") || target.empty?
|
312
|
+
new_content = target + additions.join("\n") + "\n"
|
313
|
+
File.write(target_path, new_content)
|
314
|
+
say("Updated Gemfile with entries from Gemfile.example (added #{additions.size}).")
|
315
|
+
end
|
316
|
+
|
317
|
+
# 3c. Ensure gemfiles/modular/* are present (copied like template task)
|
318
|
+
def ensure_modular_gemfiles!
|
319
|
+
helpers = Kettle::Dev::TemplateHelpers
|
320
|
+
project_root = helpers.project_root
|
321
|
+
gem_checkout_root = helpers.gem_checkout_root
|
322
|
+
# Gather min_ruby for style.gemfile adjustments
|
323
|
+
min_ruby = begin
|
324
|
+
md = helpers.gemspec_metadata(project_root)
|
325
|
+
md[:min_ruby]
|
326
|
+
rescue StandardError
|
327
|
+
nil
|
328
|
+
end
|
329
|
+
Kettle::Dev::ModularGemfiles.sync!(
|
330
|
+
helpers: helpers,
|
331
|
+
project_root: project_root,
|
332
|
+
gem_checkout_root: gem_checkout_root,
|
333
|
+
min_ruby: min_ruby,
|
334
|
+
)
|
335
|
+
end
|
336
|
+
|
184
337
|
# 5. Ensure Rakefile matches example (replace or create)
|
185
338
|
def ensure_rakefile!
|
186
339
|
source = installed_path("Rakefile.example")
|
@@ -104,91 +104,13 @@ module Kettle
|
|
104
104
|
allow_replace: true,
|
105
105
|
)
|
106
106
|
|
107
|
-
#
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
injected
|
115
|
-
optional
|
116
|
-
runtime_heads
|
117
|
-
x_std_libs
|
118
|
-
]
|
119
|
-
modular_gemfiles.each do |base|
|
120
|
-
modular_gemfile = "#{base}.gemfile"
|
121
|
-
src = helpers.prefer_example(File.join(gem_checkout_root, MODULAR_GEMFILE_DIR, modular_gemfile))
|
122
|
-
dest = File.join(project_root, MODULAR_GEMFILE_DIR, modular_gemfile)
|
123
|
-
helpers.copy_file_with_prompt(src, dest, allow_create: true, allow_replace: true)
|
124
|
-
end
|
125
|
-
|
126
|
-
# 4b) gemfiles/modular/style.gemfile
|
127
|
-
modular_gemfile = "style.gemfile"
|
128
|
-
src = helpers.prefer_example(File.join(gem_checkout_root, MODULAR_GEMFILE_DIR, modular_gemfile))
|
129
|
-
dest = File.join(project_root, MODULAR_GEMFILE_DIR, modular_gemfile)
|
130
|
-
if File.basename(src).sub(/\.example\z/, "") == "style.gemfile"
|
131
|
-
helpers.copy_file_with_prompt(src, dest, allow_create: true, allow_replace: true) do |content|
|
132
|
-
# Adjust rubocop-lts constraint based on min_ruby
|
133
|
-
version_map = [
|
134
|
-
[Gem::Version.new("1.8"), "~> 0.1"],
|
135
|
-
[Gem::Version.new("1.9"), "~> 2.0"],
|
136
|
-
[Gem::Version.new("2.0"), "~> 4.0"],
|
137
|
-
[Gem::Version.new("2.1"), "~> 6.0"],
|
138
|
-
[Gem::Version.new("2.2"), "~> 8.0"],
|
139
|
-
[Gem::Version.new("2.3"), "~> 10.0"],
|
140
|
-
[Gem::Version.new("2.4"), "~> 12.0"],
|
141
|
-
[Gem::Version.new("2.5"), "~> 14.0"],
|
142
|
-
[Gem::Version.new("2.6"), "~> 16.0"],
|
143
|
-
[Gem::Version.new("2.7"), "~> 18.0"],
|
144
|
-
[Gem::Version.new("3.0"), "~> 20.0"],
|
145
|
-
[Gem::Version.new("3.1"), "~> 22.0"],
|
146
|
-
[Gem::Version.new("3.2"), "~> 24.0"],
|
147
|
-
[Gem::Version.new("3.3"), "~> 26.0"],
|
148
|
-
[Gem::Version.new("3.4"), "~> 28.0"],
|
149
|
-
]
|
150
|
-
new_constraint = nil
|
151
|
-
rubocop_ruby_gem_version = nil
|
152
|
-
ruby1_8 = version_map.first
|
153
|
-
begin
|
154
|
-
if min_ruby
|
155
|
-
version_map.reverse_each do |min, req|
|
156
|
-
if min_ruby >= min
|
157
|
-
new_constraint = req
|
158
|
-
rubocop_ruby_gem_version = min.segments.join("_")
|
159
|
-
break
|
160
|
-
end
|
161
|
-
end
|
162
|
-
end
|
163
|
-
if !new_constraint || !rubocop_ruby_gem_version
|
164
|
-
# A gem with no declared minimum ruby is effectively >= 1.8.7
|
165
|
-
new_constraint = ruby1_8[1]
|
166
|
-
rubocop_ruby_gem_version = ruby1_8[0].segments.join("_")
|
167
|
-
end
|
168
|
-
rescue StandardError => e
|
169
|
-
Kettle::Dev.debug_error(e, __method__)
|
170
|
-
# ignore, use default
|
171
|
-
ensure
|
172
|
-
new_constraint ||= ruby1_8[1]
|
173
|
-
rubocop_ruby_gem_version ||= ruby1_8[0].segments.join("_")
|
174
|
-
end
|
175
|
-
if new_constraint && rubocop_ruby_gem_version
|
176
|
-
token = "{RUBOCOP|LTS|CONSTRAINT}"
|
177
|
-
content.gsub!(token, new_constraint) if content.include?(token)
|
178
|
-
token = "{RUBOCOP|RUBY|GEM}"
|
179
|
-
content.gsub!(token, "rubocop-ruby#{rubocop_ruby_gem_version}") if content.include?(token)
|
180
|
-
end
|
181
|
-
end
|
182
|
-
else
|
183
|
-
helpers.copy_file_with_prompt(src, dest, allow_create: true, allow_replace: true)
|
184
|
-
end
|
185
|
-
|
186
|
-
# 4c) Copy modular directories with nested/versioned files
|
187
|
-
%w[erb mutex_m stringio x_std_libs].each do |dir|
|
188
|
-
src_dir = File.join(gem_checkout_root, MODULAR_GEMFILE_DIR, dir)
|
189
|
-
dest_dir = File.join(project_root, MODULAR_GEMFILE_DIR, dir)
|
190
|
-
helpers.copy_dir_with_prompt(src_dir, dest_dir)
|
191
|
-
end
|
107
|
+
# 4) gemfiles/modular/* and nested directories (delegated for DRYness)
|
108
|
+
Kettle::Dev::ModularGemfiles.sync!(
|
109
|
+
helpers: helpers,
|
110
|
+
project_root: project_root,
|
111
|
+
gem_checkout_root: gem_checkout_root,
|
112
|
+
min_ruby: min_ruby,
|
113
|
+
)
|
192
114
|
|
193
115
|
# 5) spec/spec_helper.rb (no create)
|
194
116
|
dest_spec_helper = File.join(project_root, "spec/spec_helper.rb")
|
data/lib/kettle/dev/version.rb
CHANGED
data/lib/kettle/dev.rb
CHANGED
@@ -26,6 +26,7 @@ module Kettle
|
|
26
26
|
autoload :PreReleaseCLI, "kettle/dev/pre_release_cli"
|
27
27
|
autoload :SetupCLI, "kettle/dev/setup_cli"
|
28
28
|
autoload :TemplateHelpers, "kettle/dev/template_helpers"
|
29
|
+
autoload :ModularGemfiles, "kettle/dev/modular_gemfiles"
|
29
30
|
autoload :Version, "kettle/dev/version"
|
30
31
|
autoload :Versioning, "kettle/dev/versioning"
|
31
32
|
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kettle-dev
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter H. Boling
|
@@ -333,6 +333,7 @@ files:
|
|
333
333
|
- lib/kettle/dev/git_adapter.rb
|
334
334
|
- lib/kettle/dev/git_commit_footer.rb
|
335
335
|
- lib/kettle/dev/input_adapter.rb
|
336
|
+
- lib/kettle/dev/modular_gemfiles.rb
|
336
337
|
- lib/kettle/dev/pre_release_cli.rb
|
337
338
|
- lib/kettle/dev/rakelib/appraisal.rake
|
338
339
|
- lib/kettle/dev/rakelib/bench.rake
|
@@ -367,6 +368,7 @@ files:
|
|
367
368
|
- sig/kettle/dev/git_adapter.rbs
|
368
369
|
- sig/kettle/dev/git_commit_footer.rbs
|
369
370
|
- sig/kettle/dev/input_adapter.rbs
|
371
|
+
- sig/kettle/dev/modular_gemfiles.rbs
|
370
372
|
- sig/kettle/dev/pre_release_cli.rbs
|
371
373
|
- sig/kettle/dev/readme_backers.rbs
|
372
374
|
- sig/kettle/dev/release_cli.rbs
|
@@ -383,10 +385,10 @@ licenses:
|
|
383
385
|
- MIT
|
384
386
|
metadata:
|
385
387
|
homepage_uri: https://kettle-dev.galtzo.com/
|
386
|
-
source_code_uri: https://github.com/kettle-rb/kettle-dev/tree/v1.1.
|
387
|
-
changelog_uri: https://github.com/kettle-rb/kettle-dev/blob/v1.1.
|
388
|
+
source_code_uri: https://github.com/kettle-rb/kettle-dev/tree/v1.1.12
|
389
|
+
changelog_uri: https://github.com/kettle-rb/kettle-dev/blob/v1.1.12/CHANGELOG.md
|
388
390
|
bug_tracker_uri: https://github.com/kettle-rb/kettle-dev/issues
|
389
|
-
documentation_uri: https://www.rubydoc.info/gems/kettle-dev/1.1.
|
391
|
+
documentation_uri: https://www.rubydoc.info/gems/kettle-dev/1.1.12
|
390
392
|
funding_uri: https://github.com/sponsors/pboling
|
391
393
|
wiki_uri: https://github.com/kettle-rb/kettle-dev/wiki
|
392
394
|
news_uri: https://www.railsbling.com/tags/kettle-dev
|
metadata.gz.sig
CHANGED
Binary file
|