kettle-dev 2.0.5 → 2.0.7
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/CHANGELOG.md +55 -1
- data/CONTRIBUTING.md +17 -1
- data/README.md +124 -323
- data/exe/kettle-changelog +3 -1
- data/exe/kettle-commit-msg +3 -3
- data/exe/kettle-dev-setup +4 -4
- data/exe/kettle-dvcs +1 -1
- data/exe/kettle-gh-release +1 -1
- data/exe/kettle-pre-release +2 -2
- data/exe/kettle-readme-backers +1 -1
- data/exe/kettle-release +1 -1
- data/lib/kettle/dev/changelog_cli.rb +15 -30
- data/lib/kettle/dev/ci_helpers.rb +5 -5
- data/lib/kettle/dev/ci_monitor.rb +8 -8
- data/lib/kettle/dev/commit_msg.rb +2 -2
- data/lib/kettle/dev/dvcs_cli.rb +8 -8
- data/lib/kettle/dev/gem_spec_reader.rb +8 -8
- data/lib/kettle/dev/git_adapter.rb +17 -17
- data/lib/kettle/dev/git_commit_footer.rb +3 -3
- data/lib/kettle/dev/open_collective_config.rb +1 -1
- data/lib/kettle/dev/pre_release_cli.rb +7 -7
- data/lib/kettle/dev/rakelib/appraisal.rake +1 -1
- data/lib/kettle/dev/readme_backers.rb +15 -16
- data/lib/kettle/dev/release_cli.rb +15 -15
- data/lib/kettle/dev/tasks/ci_task.rb +15 -14
- data/lib/kettle/dev/version.rb +1 -1
- data/lib/kettle/dev/versioning.rb +18 -3
- data/lib/kettle/dev.rb +3 -3
- data/lib/kettle-dev.rb +1 -1
- data.tar.gz.sig +1 -2
- metadata +8 -8
- metadata.gz.sig +0 -0
data/exe/kettle-commit-msg
CHANGED
|
@@ -40,7 +40,7 @@ end
|
|
|
40
40
|
# BRANCH_RULE_TYPE = jira, or another type of branch rule validation, or false to disable
|
|
41
41
|
# FOOTER_APPEND = true/false append commit message footer
|
|
42
42
|
BRANCH_RULES = {
|
|
43
|
-
"jira" => /^(?<story_type>
|
|
43
|
+
"jira" => /^(?<story_type>hotfix|bug|feature|candy)\/(?<story_id>\d{8,})-.+\Z/
|
|
44
44
|
}
|
|
45
45
|
# Ruby 2.3 compatibility: String#casecmp? is not available; use casecmp.zero?
|
|
46
46
|
BRANCH_RULE_TYPE = (validate = ENV.fetch("GIT_HOOK_BRANCH_VALIDATE", "false")) && !(validate.respond_to?(:casecmp?) ? validate.casecmp?("false") : (validate.casecmp("false").zero?)) && validate
|
|
@@ -51,7 +51,7 @@ if (branch_rule = BRANCH_RULES[BRANCH_RULE_TYPE])
|
|
|
51
51
|
# <story_type>/<story_id>-explosion-in-the-fudge-factory-spec-suite-fix
|
|
52
52
|
# where story type is one of "hotfix", "bug", "feature", "candy"
|
|
53
53
|
#
|
|
54
|
-
branch =
|
|
54
|
+
branch = `git branch 2> /dev/null | grep -e ^* | awk '{print $2}'`
|
|
55
55
|
match_data = branch.match(branch_rule)
|
|
56
56
|
# NOTE: `match` will return nil if match fails, otherwise an instance of MatchData.
|
|
57
57
|
# If not nil then we are assured matches for both regex capture groups
|
|
@@ -84,7 +84,7 @@ rescue SystemExit => e
|
|
|
84
84
|
# Preserve exit status, but ensure at least a newline so shells don't show an empty line only.
|
|
85
85
|
warn("#{script_basename}: exited (status=#{e.status}, msg=#{e.message})") if e.status != 0
|
|
86
86
|
raise
|
|
87
|
-
rescue
|
|
87
|
+
rescue => e
|
|
88
88
|
warn("#{script_basename}: unexpected error: #{e.class}: #{e.message}")
|
|
89
89
|
warn(e.backtrace.join("\n"))
|
|
90
90
|
exit(1)
|
data/exe/kettle-dev-setup
CHANGED
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
|
|
4
4
|
# vim: set syntax=ruby
|
|
5
5
|
|
|
6
|
-
# kettle-dev-setup has been replaced by kettle-jem
|
|
6
|
+
# kettle-dev-setup has been replaced by kettle-jem setup.
|
|
7
7
|
# All setup and templating functionality has moved to the kettle-jem gem.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
warn <<~MSG
|
|
10
10
|
kettle-dev-setup has been removed.
|
|
11
11
|
Setup and templating functionality has moved to the kettle-jem gem.
|
|
12
12
|
|
|
13
|
-
Please install kettle-jem and use kettle-jem
|
|
13
|
+
Please install kettle-jem and use kettle-jem setup instead:
|
|
14
14
|
gem install kettle-jem
|
|
15
|
-
kettle-jem
|
|
15
|
+
kettle-jem setup
|
|
16
16
|
MSG
|
|
17
17
|
exit 1
|
data/exe/kettle-dvcs
CHANGED
|
@@ -70,7 +70,7 @@ rescue LoadError => e
|
|
|
70
70
|
rescue SystemExit => e
|
|
71
71
|
warn("#{script_basename}: exited (status=#{e.status}, msg=#{e.message})") if e.status != 0
|
|
72
72
|
raise
|
|
73
|
-
rescue
|
|
73
|
+
rescue => e
|
|
74
74
|
warn("#{script_basename}: unexpected error: #{e.class}: #{e.message}")
|
|
75
75
|
warn(e.backtrace.join("\n"))
|
|
76
76
|
exit(1)
|
data/exe/kettle-gh-release
CHANGED
|
@@ -75,7 +75,7 @@ rescue SystemExit => e
|
|
|
75
75
|
# Preserve exit status, but ensure at least a newline so shells don't show an empty line only.
|
|
76
76
|
warn("#{script_basename}: exited (status=#{e.status}, msg=#{e.message})") if e.status != 0
|
|
77
77
|
raise
|
|
78
|
-
rescue
|
|
78
|
+
rescue => e
|
|
79
79
|
warn("#{script_basename}: unexpected error: #{e.class}: #{e.message}")
|
|
80
80
|
warn(Array(e.backtrace).join("\n"))
|
|
81
81
|
exit(1)
|
data/exe/kettle-pre-release
CHANGED
|
@@ -26,7 +26,7 @@ script_basename = File.basename(__FILE__)
|
|
|
26
26
|
begin
|
|
27
27
|
require "kettle/dev"
|
|
28
28
|
puts "== #{script_basename} v#{Kettle::Dev::Version::VERSION} =="
|
|
29
|
-
rescue
|
|
29
|
+
rescue => e
|
|
30
30
|
warn("#{script_basename}: could not load dependency: #{e.class}: #{e.message}")
|
|
31
31
|
warn("Hint: Ensure the host project has kettle-dev as a dependency and run bundle install.")
|
|
32
32
|
exit(1)
|
|
@@ -34,7 +34,7 @@ end
|
|
|
34
34
|
|
|
35
35
|
# Option parsing
|
|
36
36
|
options = {
|
|
37
|
-
check_num: 1
|
|
37
|
+
check_num: 1
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
parser = OptionParser.new do |opts|
|
data/exe/kettle-readme-backers
CHANGED
|
@@ -34,7 +34,7 @@ rescue SystemExit => e
|
|
|
34
34
|
# Preserve exit status, but ensure at least a newline so shells don't show an empty line only.
|
|
35
35
|
warn("#{script_basename}: exited (status=#{e.status}, msg=#{e.message})") if e.status != 0
|
|
36
36
|
raise
|
|
37
|
-
rescue
|
|
37
|
+
rescue => e
|
|
38
38
|
warn("#{script_basename}: unexpected error: #{e.class}: #{e.message}")
|
|
39
39
|
warn(e.backtrace.join("\n"))
|
|
40
40
|
exit(1)
|
data/exe/kettle-release
CHANGED
|
@@ -102,7 +102,7 @@ rescue SystemExit => e
|
|
|
102
102
|
# Preserve exit status, but ensure at least a newline so shells don't show an empty line only.
|
|
103
103
|
warn("#{script_basename}: exited (status=#{e.status}, msg=#{e.message})") if e.status != 0
|
|
104
104
|
raise
|
|
105
|
-
rescue
|
|
105
|
+
rescue => e
|
|
106
106
|
warn("#{script_basename}: unexpected error: #{e.class}: #{e.message}")
|
|
107
107
|
warn(Array(e.backtrace).join("\n"))
|
|
108
108
|
exit(1)
|
|
@@ -17,7 +17,7 @@ module Kettle
|
|
|
17
17
|
# Matches a Markdown link-reference definition line, e.g. `[key]: https://...`
|
|
18
18
|
LINK_REF_DEF_RE = /^\s*\[[^\]]+\]:\s+\S+/
|
|
19
19
|
# Matches an ATX heading at H4 or deeper (####, #####, ...)
|
|
20
|
-
DEEP_HEADING_RE =
|
|
20
|
+
DEEP_HEADING_RE = /^\#{4,}\s/
|
|
21
21
|
|
|
22
22
|
# Initialize the changelog CLI
|
|
23
23
|
# Sets up paths for CHANGELOG.md and coverage.json
|
|
@@ -148,7 +148,7 @@ module Kettle
|
|
|
148
148
|
begin
|
|
149
149
|
gem_name = detect_gem_name
|
|
150
150
|
latest_overall, latest_for_series = latest_released_versions(gem_name, version)
|
|
151
|
-
rescue
|
|
151
|
+
rescue => e
|
|
152
152
|
warn("[kettle-changelog] gem.coop release check failed: #{e.class}: #{e.message}")
|
|
153
153
|
warn("Proceeding without live release info.")
|
|
154
154
|
end
|
|
@@ -186,7 +186,7 @@ module Kettle
|
|
|
186
186
|
latest_overall: latest_overall,
|
|
187
187
|
latest_for_series: latest_for_series,
|
|
188
188
|
latest_target: latest_target,
|
|
189
|
-
latest_changelog_version: latest_changelog_version
|
|
189
|
+
latest_changelog_version: latest_changelog_version
|
|
190
190
|
}
|
|
191
191
|
end
|
|
192
192
|
|
|
@@ -203,7 +203,7 @@ module Kettle
|
|
|
203
203
|
latest_for_series: nil,
|
|
204
204
|
latest_target: nil,
|
|
205
205
|
latest_changelog_version: prepared_version,
|
|
206
|
-
explicit: true
|
|
206
|
+
explicit: true
|
|
207
207
|
}
|
|
208
208
|
end
|
|
209
209
|
|
|
@@ -273,7 +273,7 @@ module Kettle
|
|
|
273
273
|
series = cur.segments[0, 2]
|
|
274
274
|
latest_series = gversions.reverse.find { |gv| gv.segments[0, 2] == series }&.to_s
|
|
275
275
|
[latest_overall, latest_series]
|
|
276
|
-
rescue
|
|
276
|
+
rescue => e
|
|
277
277
|
Kettle::Dev.debug_error(e, __method__)
|
|
278
278
|
[nil, nil]
|
|
279
279
|
end
|
|
@@ -299,18 +299,7 @@ module Kettle
|
|
|
299
299
|
end
|
|
300
300
|
|
|
301
301
|
def detect_version
|
|
302
|
-
|
|
303
|
-
abort("Could not find version.rb under lib/**.") if candidates.empty?
|
|
304
|
-
versions = candidates.map do |path|
|
|
305
|
-
content = File.read(path)
|
|
306
|
-
m = content.match(/VERSION\s*=\s*(["'])([^"']+)\1/)
|
|
307
|
-
next unless m
|
|
308
|
-
|
|
309
|
-
m[2]
|
|
310
|
-
end.compact
|
|
311
|
-
abort("VERSION constant not found in #{@root}/lib/**/version.rb") if versions.none?
|
|
312
|
-
abort("Multiple VERSION constants found to be out of sync (#{versions.inspect}) in #{@root}/lib/**/version.rb") unless versions.uniq.length == 1
|
|
313
|
-
versions.first
|
|
302
|
+
Kettle::Dev::Versioning.detect_version(@root)
|
|
314
303
|
end
|
|
315
304
|
|
|
316
305
|
def extract_unreleased(content)
|
|
@@ -583,7 +572,7 @@ module Kettle
|
|
|
583
572
|
warn("Failed to parse coverage: #{e.class}: #{e.message}")
|
|
584
573
|
[nil, nil]
|
|
585
574
|
end
|
|
586
|
-
rescue
|
|
575
|
+
rescue => e
|
|
587
576
|
if @strict
|
|
588
577
|
raise "Failed to get coverage data: #{e.class}: #{e.message}"
|
|
589
578
|
else
|
|
@@ -598,7 +587,7 @@ module Kettle
|
|
|
598
587
|
"K_SOUP_COV_FORMATTERS" => "json",
|
|
599
588
|
"K_SOUP_COV_MIN_HARD" => @enforce_coverage_thresholds ? "true" : "false",
|
|
600
589
|
"K_SOUP_COV_MULTI_FORMATTERS" => "true",
|
|
601
|
-
"K_SOUP_COV_OPEN_BIN" => ""
|
|
590
|
+
"K_SOUP_COV_OPEN_BIN" => ""
|
|
602
591
|
}
|
|
603
592
|
end
|
|
604
593
|
|
|
@@ -612,7 +601,7 @@ module Kettle
|
|
|
612
601
|
[
|
|
613
602
|
"Coverage JSON not found at #{Kettle::Dev.display_path(@coverage_path)} after running bundle exec kettle-test.",
|
|
614
603
|
"kettle-test runs specs in parallel and is expected to collate parallel SimpleCov results into this canonical file.",
|
|
615
|
-
"If it is missing, coverage was not enabled in ENV config or the rake/task hooks did not load the coverage integration."
|
|
604
|
+
"If it is missing, coverage was not enabled in ENV config or the rake/task hooks did not load the coverage integration."
|
|
616
605
|
].join(" ")
|
|
617
606
|
end
|
|
618
607
|
|
|
@@ -644,7 +633,7 @@ module Kettle
|
|
|
644
633
|
warn("Could not find documented percentage in bin/rake yard output.")
|
|
645
634
|
nil
|
|
646
635
|
end
|
|
647
|
-
rescue
|
|
636
|
+
rescue => e
|
|
648
637
|
if @strict
|
|
649
638
|
raise "Failed to run bin/rake yard: #{e.class}: #{e.message}"
|
|
650
639
|
else
|
|
@@ -791,7 +780,7 @@ module Kettle
|
|
|
791
780
|
|
|
792
781
|
def update_link_refs(content, owner, repo, prev_version, new_version)
|
|
793
782
|
# Convert any GitLab links to GitHub
|
|
794
|
-
content = content.gsub(%r{https://gitlab\.com/([^/]+)/([^/]+)/-/compare/([
|
|
783
|
+
content = content.gsub(%r{https://gitlab\.com/([^/]+)/([^/]+)/-/compare/([^.]+)\.\.\.([^\s]+)}) do
|
|
795
784
|
o = owner || Regexp.last_match(1)
|
|
796
785
|
r = repo || Regexp.last_match(2)
|
|
797
786
|
from = Regexp.last_match(3)
|
|
@@ -812,12 +801,8 @@ module Kettle
|
|
|
812
801
|
# Do NOT assume the first link-ref after the Unreleased heading starts the footer, because
|
|
813
802
|
# some changelogs contain interspersed link-refs within section bodies.
|
|
814
803
|
unreleased_ref_idx = lines.index { |l| l.start_with?(UNRELEASED_SECTION_HEADING) }
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
else
|
|
818
|
-
# If no [Unreleased]: ref is present, consider the reference block to start at EOF
|
|
819
|
-
lines.length
|
|
820
|
-
end
|
|
804
|
+
# If no [Unreleased]: ref is present, consider the reference block to start at EOF
|
|
805
|
+
first_ref = unreleased_ref_idx || lines.length
|
|
821
806
|
|
|
822
807
|
# Ensure Unreleased points to GitHub compare from new tag to HEAD
|
|
823
808
|
if owner && repo
|
|
@@ -968,7 +953,7 @@ module Kettle
|
|
|
968
953
|
|
|
969
954
|
warn(
|
|
970
955
|
"Could not determine initial git root commit; using HEAD^ as compare base. " \
|
|
971
|
-
"Set KETTLE_CHANGELOG_INITIAL_SHA to override."
|
|
956
|
+
"Set KETTLE_CHANGELOG_INITIAL_SHA to override."
|
|
972
957
|
)
|
|
973
958
|
"HEAD^"
|
|
974
959
|
end
|
|
@@ -980,7 +965,7 @@ module Kettle
|
|
|
980
965
|
out, ok = adapter.capture(["rev-list", "--max-parents=0", "HEAD"])
|
|
981
966
|
sha = out.to_s.lines.last&.strip # take last line in case of multiple root commits
|
|
982
967
|
(ok && sha && !sha.empty?) ? sha : nil
|
|
983
|
-
rescue
|
|
968
|
+
rescue
|
|
984
969
|
nil
|
|
985
970
|
end
|
|
986
971
|
end
|
|
@@ -112,9 +112,9 @@ module Kettle
|
|
|
112
112
|
"status" => run["status"],
|
|
113
113
|
"conclusion" => run["conclusion"],
|
|
114
114
|
"html_url" => run["html_url"],
|
|
115
|
-
"id" => run["id"]
|
|
115
|
+
"id" => run["id"]
|
|
116
116
|
}
|
|
117
|
-
rescue
|
|
117
|
+
rescue => e
|
|
118
118
|
Kettle::Dev.debug_error(e, __method__)
|
|
119
119
|
nil
|
|
120
120
|
end
|
|
@@ -205,7 +205,7 @@ module Kettle
|
|
|
205
205
|
pipe["web_url"] = det["web_url"] if det["web_url"]
|
|
206
206
|
end
|
|
207
207
|
end
|
|
208
|
-
rescue
|
|
208
|
+
rescue => e
|
|
209
209
|
Kettle::Dev.debug_error(e, __method__)
|
|
210
210
|
# ignore enrichment errors; fall back to basic fields
|
|
211
211
|
end
|
|
@@ -213,9 +213,9 @@ module Kettle
|
|
|
213
213
|
"status" => pipe["status"],
|
|
214
214
|
"web_url" => pipe["web_url"],
|
|
215
215
|
"id" => pipe["id"],
|
|
216
|
-
"failure_reason" => pipe["failure_reason"]
|
|
216
|
+
"failure_reason" => pipe["failure_reason"]
|
|
217
217
|
}
|
|
218
|
-
rescue
|
|
218
|
+
rescue => e
|
|
219
219
|
Kettle::Dev.debug_error(e, __method__)
|
|
220
220
|
nil
|
|
221
221
|
end
|
|
@@ -78,13 +78,13 @@ module Kettle
|
|
|
78
78
|
begin
|
|
79
79
|
gh = collect_github
|
|
80
80
|
results[:github] = gh if gh
|
|
81
|
-
rescue
|
|
81
|
+
rescue => e
|
|
82
82
|
Kettle::Dev.debug_error(e, __method__)
|
|
83
83
|
end
|
|
84
84
|
begin
|
|
85
85
|
gl = collect_gitlab
|
|
86
86
|
results[:gitlab] = gl if gl
|
|
87
|
-
rescue
|
|
87
|
+
rescue => e
|
|
88
88
|
Kettle::Dev.debug_error(e, __method__)
|
|
89
89
|
end
|
|
90
90
|
results
|
|
@@ -99,12 +99,12 @@ module Kettle
|
|
|
99
99
|
gh_items = results[:github] || []
|
|
100
100
|
unless gh_items.empty?
|
|
101
101
|
puts "GitHub Actions:"
|
|
102
|
-
gh_items.each do |
|
|
103
|
-
emoji = status_emoji(
|
|
104
|
-
details = [
|
|
105
|
-
wf =
|
|
106
|
-
puts " - #{wf}: #{emoji} (#{details}) #{"-> #{
|
|
107
|
-
all_ok &&= (
|
|
102
|
+
gh_items.each do |item|
|
|
103
|
+
emoji = status_emoji(item[:status], item[:conclusion])
|
|
104
|
+
details = [item[:status], item[:conclusion]].compact.join("/")
|
|
105
|
+
wf = item[:workflow]
|
|
106
|
+
puts " - #{wf}: #{emoji} (#{details}) #{"-> #{item[:url]}" if item[:url]}"
|
|
107
|
+
all_ok &&= (item[:conclusion] == "success")
|
|
108
108
|
end
|
|
109
109
|
end
|
|
110
110
|
gl = results[:gitlab]
|
|
@@ -9,7 +9,7 @@ module Kettle
|
|
|
9
9
|
module_function
|
|
10
10
|
|
|
11
11
|
BRANCH_RULES = {
|
|
12
|
-
"jira" => /^(?<story_type>
|
|
12
|
+
"jira" => /^(?<story_type>hotfix|bug|feature|candy)\/(?<story_id>\d{8,})-.+\Z/
|
|
13
13
|
}.freeze
|
|
14
14
|
|
|
15
15
|
# Enforce branch rule by appending [type][id] to the commit message when missing.
|
|
@@ -22,7 +22,7 @@ module Kettle
|
|
|
22
22
|
branch_rule = BRANCH_RULES[branch_rule_type]
|
|
23
23
|
return unless branch_rule
|
|
24
24
|
|
|
25
|
-
branch =
|
|
25
|
+
branch = `git branch 2> /dev/null | grep -e ^* | awk '{print $2}'`
|
|
26
26
|
match_data = branch.match(branch_rule)
|
|
27
27
|
return unless match_data
|
|
28
28
|
|
data/lib/kettle/dev/dvcs_cli.rb
CHANGED
|
@@ -35,12 +35,12 @@ module Kettle
|
|
|
35
35
|
gl_name: "gl",
|
|
36
36
|
cb_name: "cb",
|
|
37
37
|
force: false,
|
|
38
|
-
status: false
|
|
38
|
+
status: false
|
|
39
39
|
}.freeze
|
|
40
40
|
FORGE_MIGRATION_TOOLS = {
|
|
41
41
|
github: "https://github.com/new/import",
|
|
42
42
|
gitlab: "https://gitlab.com/projects/new#import_project",
|
|
43
|
-
codeberg: "https://codeberg.org/repo/migrate"
|
|
43
|
+
codeberg: "https://codeberg.org/repo/migrate"
|
|
44
44
|
}.freeze
|
|
45
45
|
|
|
46
46
|
# Create the CLI with argv-like arguments
|
|
@@ -123,7 +123,7 @@ module Kettle
|
|
|
123
123
|
{
|
|
124
124
|
github: names[:github],
|
|
125
125
|
gitlab: names[:gitlab],
|
|
126
|
-
codeberg: names[:codeberg]
|
|
126
|
+
codeberg: names[:codeberg]
|
|
127
127
|
}.each do |forge, remote|
|
|
128
128
|
next unless remote
|
|
129
129
|
next if remote == names[:origin]
|
|
@@ -209,7 +209,7 @@ module Kettle
|
|
|
209
209
|
github: (@opts[:origin] == "github") ? "origin" : @opts[:gh_name],
|
|
210
210
|
gitlab: (@opts[:origin] == "gitlab") ? "origin" : @opts[:gl_name],
|
|
211
211
|
codeberg: (@opts[:origin] == "codeberg") ? "origin" : @opts[:cb_name],
|
|
212
|
-
all: "all"
|
|
212
|
+
all: "all"
|
|
213
213
|
}
|
|
214
214
|
end
|
|
215
215
|
|
|
@@ -219,13 +219,13 @@ module Kettle
|
|
|
219
219
|
{
|
|
220
220
|
github: "git@github.com:#{org}/#{repo}.git",
|
|
221
221
|
gitlab: "git@gitlab.com:#{org}/#{repo}.git",
|
|
222
|
-
codeberg: "git@codeberg.org:#{org}/#{repo}.git"
|
|
222
|
+
codeberg: "git@codeberg.org:#{org}/#{repo}.git"
|
|
223
223
|
}
|
|
224
224
|
else # https
|
|
225
225
|
{
|
|
226
226
|
github: "https://github.com/#{org}/#{repo}.git",
|
|
227
227
|
gitlab: "https://gitlab.com/#{org}/#{repo}.git",
|
|
228
|
-
codeberg: "https://codeberg.org/#{org}/#{repo}.git"
|
|
228
|
+
codeberg: "https://codeberg.org/#{org}/#{repo}.git"
|
|
229
229
|
}
|
|
230
230
|
end
|
|
231
231
|
end
|
|
@@ -344,7 +344,7 @@ module Kettle
|
|
|
344
344
|
{
|
|
345
345
|
github: names[:github],
|
|
346
346
|
gitlab: names[:gitlab],
|
|
347
|
-
codeberg: names[:codeberg]
|
|
347
|
+
codeberg: names[:codeberg]
|
|
348
348
|
}.each do |forge, remote_name|
|
|
349
349
|
next unless remote_name
|
|
350
350
|
|
|
@@ -388,7 +388,7 @@ module Kettle
|
|
|
388
388
|
say(" - #{forge.capitalize} import: #{FORGE_MIGRATION_TOOLS[forge]}")
|
|
389
389
|
end
|
|
390
390
|
end
|
|
391
|
-
rescue
|
|
391
|
+
rescue => e
|
|
392
392
|
warn("Failed to update README federation status: #{e.message}")
|
|
393
393
|
end
|
|
394
394
|
|
|
@@ -53,7 +53,7 @@ module Kettle
|
|
|
53
53
|
if gemspec_path && File.file?(gemspec_path)
|
|
54
54
|
begin
|
|
55
55
|
spec = Gem::Specification.load(gemspec_path)
|
|
56
|
-
rescue
|
|
56
|
+
rescue => e
|
|
57
57
|
Kettle::Dev.debug_error(e, __method__)
|
|
58
58
|
spec = nil
|
|
59
59
|
end
|
|
@@ -62,7 +62,7 @@ module Kettle
|
|
|
62
62
|
gemspec_source = if gemspec_path && File.file?(gemspec_path)
|
|
63
63
|
begin
|
|
64
64
|
File.read(gemspec_path)
|
|
65
|
-
rescue
|
|
65
|
+
rescue => e
|
|
66
66
|
Kettle::Dev.debug_error(e, __method__)
|
|
67
67
|
""
|
|
68
68
|
end
|
|
@@ -91,7 +91,7 @@ module Kettle
|
|
|
91
91
|
puts "WARNING: Minimum Ruby not detected"
|
|
92
92
|
DEFAULT_MINIMUM_RUBY
|
|
93
93
|
end
|
|
94
|
-
rescue
|
|
94
|
+
rescue => e
|
|
95
95
|
puts "WARNING: Minimum Ruby detection failed:"
|
|
96
96
|
Kettle::Dev.debug_error(e, __method__)
|
|
97
97
|
# Default to a minimum of Ruby 1.8
|
|
@@ -117,7 +117,7 @@ module Kettle
|
|
|
117
117
|
entrypoint_require = derive_entrypoint_require(
|
|
118
118
|
root: root,
|
|
119
119
|
gem_name: gem_name,
|
|
120
|
-
gemspec_source: gemspec_source
|
|
120
|
+
gemspec_source: gemspec_source
|
|
121
121
|
)
|
|
122
122
|
namespace_source = entrypoint_require.to_s.empty? ? gem_name.to_s.tr("-", "/") : entrypoint_require.to_s
|
|
123
123
|
namespace = namespace_source.split("/").reject(&:empty?).map { |seg| camel.call(seg) }.join("::")
|
|
@@ -153,7 +153,7 @@ module Kettle
|
|
|
153
153
|
end
|
|
154
154
|
end
|
|
155
155
|
end
|
|
156
|
-
rescue
|
|
156
|
+
rescue => error
|
|
157
157
|
Kettle::Dev.debug_error(error, __method__)
|
|
158
158
|
# In an unexpected exception path, escalate to a domain error to aid callers/specs
|
|
159
159
|
raise Kettle::Dev::Error, "Unable to determine funding org: #{error.message}"
|
|
@@ -182,7 +182,7 @@ module Kettle
|
|
|
182
182
|
required_ruby_version: spec&.required_ruby_version, # Gem::Requirement instance
|
|
183
183
|
require_paths: Array(spec&.require_paths),
|
|
184
184
|
bindir: (spec&.bindir || "").to_s,
|
|
185
|
-
executables: Array(spec&.executables)
|
|
185
|
+
executables: Array(spec&.executables)
|
|
186
186
|
}
|
|
187
187
|
|
|
188
188
|
CACHE.mutex.synchronize do
|
|
@@ -223,7 +223,7 @@ module Kettle
|
|
|
223
223
|
forge_info[:forge_org] = m[1]
|
|
224
224
|
forge_info[:origin_repo] = m[2].to_s.sub(/\.git\z/, "")
|
|
225
225
|
end
|
|
226
|
-
rescue
|
|
226
|
+
rescue => error
|
|
227
227
|
Kettle::Dev.debug_error(error, __method__)
|
|
228
228
|
# be lenient here; actual error raising will occur in caller if required
|
|
229
229
|
end
|
|
@@ -255,7 +255,7 @@ module Kettle
|
|
|
255
255
|
content = source.to_s
|
|
256
256
|
patterns = [
|
|
257
257
|
%r{require_relative\s+["']lib/([^"']+)/version["']},
|
|
258
|
-
%r{Kernel\.load\(\s*["'][
|
|
258
|
+
%r{Kernel\.load\(\s*["']\#[{]__dir__[}]/lib/([^"']+)/version\.rb["']}
|
|
259
259
|
]
|
|
260
260
|
|
|
261
261
|
patterns.each do |pattern|
|
|
@@ -23,7 +23,7 @@ module Kettle
|
|
|
23
23
|
status = @git.status
|
|
24
24
|
# git gem's Status responds to changed, added, deleted, untracked, etc.
|
|
25
25
|
status.changed.empty? && status.added.empty? && status.deleted.empty? && status.untracked.empty?
|
|
26
|
-
rescue
|
|
26
|
+
rescue => e
|
|
27
27
|
Kettle::Dev.debug_error(e, __method__)
|
|
28
28
|
false
|
|
29
29
|
end
|
|
@@ -31,7 +31,7 @@ module Kettle
|
|
|
31
31
|
out, st = Open3.capture2("git", "status", "--porcelain")
|
|
32
32
|
st.success? && out.strip.empty?
|
|
33
33
|
end
|
|
34
|
-
rescue
|
|
34
|
+
rescue => e
|
|
35
35
|
Kettle::Dev.debug_error(e, __method__)
|
|
36
36
|
false
|
|
37
37
|
end
|
|
@@ -45,7 +45,7 @@ module Kettle
|
|
|
45
45
|
def capture(args)
|
|
46
46
|
out, status = Open3.capture2("git", *args)
|
|
47
47
|
[out.strip, status.success?]
|
|
48
|
-
rescue
|
|
48
|
+
rescue => e
|
|
49
49
|
Kettle::Dev.debug_error(e, __method__)
|
|
50
50
|
["", false]
|
|
51
51
|
end
|
|
@@ -70,7 +70,7 @@ module Kettle
|
|
|
70
70
|
Kettle::Dev.debug_error(e, __method__, backtrace: false)
|
|
71
71
|
# Optional dependency: fall back to CLI
|
|
72
72
|
@backend = :cli
|
|
73
|
-
rescue
|
|
73
|
+
rescue => e
|
|
74
74
|
raise Kettle::Dev::Error, "Failed to open git repository: #{e.message}"
|
|
75
75
|
end
|
|
76
76
|
end
|
|
@@ -90,7 +90,7 @@ module Kettle
|
|
|
90
90
|
@git.push(nil, branch, force: force)
|
|
91
91
|
end
|
|
92
92
|
true
|
|
93
|
-
rescue
|
|
93
|
+
rescue => e
|
|
94
94
|
Kettle::Dev.debug_error(e, __method__)
|
|
95
95
|
false
|
|
96
96
|
end
|
|
@@ -129,7 +129,7 @@ module Kettle
|
|
|
129
129
|
else
|
|
130
130
|
system("git", "push", "--tags")
|
|
131
131
|
end
|
|
132
|
-
rescue
|
|
132
|
+
rescue => e
|
|
133
133
|
Kettle::Dev.debug_error(e, __method__)
|
|
134
134
|
false
|
|
135
135
|
end
|
|
@@ -142,7 +142,7 @@ module Kettle
|
|
|
142
142
|
out, status = Open3.capture2("git", "rev-parse", "--abbrev-ref", "HEAD")
|
|
143
143
|
status.success? ? out.strip : nil
|
|
144
144
|
end
|
|
145
|
-
rescue
|
|
145
|
+
rescue => e
|
|
146
146
|
Kettle::Dev.debug_error(e, __method__)
|
|
147
147
|
nil
|
|
148
148
|
end
|
|
@@ -154,7 +154,7 @@ module Kettle
|
|
|
154
154
|
if @backend == :gem
|
|
155
155
|
begin
|
|
156
156
|
@git.ls_files.keys
|
|
157
|
-
rescue
|
|
157
|
+
rescue => e
|
|
158
158
|
Kettle::Dev.debug_error(e, __method__)
|
|
159
159
|
[]
|
|
160
160
|
end
|
|
@@ -162,7 +162,7 @@ module Kettle
|
|
|
162
162
|
out, status = Open3.capture2("git", "ls-files")
|
|
163
163
|
status.success? ? out.split(/\r?\n/).reject(&:empty?) : []
|
|
164
164
|
end
|
|
165
|
-
rescue
|
|
165
|
+
rescue => e
|
|
166
166
|
Kettle::Dev.debug_error(e, __method__)
|
|
167
167
|
[]
|
|
168
168
|
end
|
|
@@ -178,7 +178,7 @@ module Kettle
|
|
|
178
178
|
def blame_porcelain(path)
|
|
179
179
|
out, status = Open3.capture2("git", "blame", "--porcelain", path.to_s)
|
|
180
180
|
status.success? ? out : ""
|
|
181
|
-
rescue
|
|
181
|
+
rescue => e
|
|
182
182
|
Kettle::Dev.debug_error(e, __method__)
|
|
183
183
|
""
|
|
184
184
|
end
|
|
@@ -191,7 +191,7 @@ module Kettle
|
|
|
191
191
|
out, status = Open3.capture2("git", "remote")
|
|
192
192
|
status.success? ? out.split(/\r?\n/).map(&:strip).reject(&:empty?) : []
|
|
193
193
|
end
|
|
194
|
-
rescue
|
|
194
|
+
rescue => e
|
|
195
195
|
Kettle::Dev.debug_error(e, __method__)
|
|
196
196
|
[]
|
|
197
197
|
end
|
|
@@ -202,7 +202,7 @@ module Kettle
|
|
|
202
202
|
@git.remotes.each_with_object({}) do |r, h|
|
|
203
203
|
begin
|
|
204
204
|
h[r.name] = r.url
|
|
205
|
-
rescue
|
|
205
|
+
rescue => e
|
|
206
206
|
Kettle::Dev.debug_error(e, __method__)
|
|
207
207
|
# ignore
|
|
208
208
|
end
|
|
@@ -220,7 +220,7 @@ module Kettle
|
|
|
220
220
|
end
|
|
221
221
|
urls
|
|
222
222
|
end
|
|
223
|
-
rescue
|
|
223
|
+
rescue => e
|
|
224
224
|
Kettle::Dev.debug_error(e, __method__)
|
|
225
225
|
{}
|
|
226
226
|
end
|
|
@@ -235,7 +235,7 @@ module Kettle
|
|
|
235
235
|
out, status = Open3.capture2("git", "config", "--get", "remote.#{name}.url")
|
|
236
236
|
status.success? ? out.strip : nil
|
|
237
237
|
end
|
|
238
|
-
rescue
|
|
238
|
+
rescue => e
|
|
239
239
|
Kettle::Dev.debug_error(e, __method__)
|
|
240
240
|
nil
|
|
241
241
|
end
|
|
@@ -250,7 +250,7 @@ module Kettle
|
|
|
250
250
|
else
|
|
251
251
|
system("git", "checkout", branch.to_s)
|
|
252
252
|
end
|
|
253
|
-
rescue
|
|
253
|
+
rescue => e
|
|
254
254
|
Kettle::Dev.debug_error(e, __method__)
|
|
255
255
|
false
|
|
256
256
|
end
|
|
@@ -266,7 +266,7 @@ module Kettle
|
|
|
266
266
|
else
|
|
267
267
|
system("git", "pull", remote.to_s, branch.to_s)
|
|
268
268
|
end
|
|
269
|
-
rescue
|
|
269
|
+
rescue => e
|
|
270
270
|
Kettle::Dev.debug_error(e, __method__)
|
|
271
271
|
false
|
|
272
272
|
end
|
|
@@ -288,7 +288,7 @@ module Kettle
|
|
|
288
288
|
else
|
|
289
289
|
system("git", "fetch", remote.to_s)
|
|
290
290
|
end
|
|
291
|
-
rescue
|
|
291
|
+
rescue => e
|
|
292
292
|
Kettle::Dev.debug_error(e, __method__)
|
|
293
293
|
false
|
|
294
294
|
end
|
|
@@ -20,9 +20,9 @@ module Kettle
|
|
|
20
20
|
def git_toplevel
|
|
21
21
|
toplevel = nil
|
|
22
22
|
begin
|
|
23
|
-
out =
|
|
23
|
+
out = `git rev-parse --show-toplevel 2>/dev/null`
|
|
24
24
|
toplevel = out.strip unless out.nil? || out.empty?
|
|
25
|
-
rescue
|
|
25
|
+
rescue => e
|
|
26
26
|
Kettle::Dev.debug_error(e, __method__)
|
|
27
27
|
nil
|
|
28
28
|
end
|
|
@@ -114,7 +114,7 @@ module Kettle
|
|
|
114
114
|
if @name_index
|
|
115
115
|
return $2
|
|
116
116
|
end
|
|
117
|
-
rescue
|
|
117
|
+
rescue => e
|
|
118
118
|
Kettle::Dev.debug_error(e, __method__)
|
|
119
119
|
end
|
|
120
120
|
nil
|
|
@@ -56,7 +56,7 @@ module Kettle
|
|
|
56
56
|
handle = yml["collective"] || yml[:collective] || yml["org"] || yml[:org]
|
|
57
57
|
return handle.to_s unless handle.nil? || handle.to_s.strip.empty? || handle.to_s.match?(/\{KJ\|[^}]+}/)
|
|
58
58
|
end
|
|
59
|
-
rescue
|
|
59
|
+
rescue => e
|
|
60
60
|
Kettle::Dev.debug_error(e, __method__) if Kettle::Dev.respond_to?(:debug_error)
|
|
61
61
|
# fall through to required check
|
|
62
62
|
end
|