bake-modernize 0.61.0 → 0.63.0
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/bake/modernize/license.rb +1 -44
- data/context/getting-started.md +3 -1
- data/lib/bake/modernize/license.rb +49 -0
- data/lib/bake/modernize/version.rb +1 -1
- data/license.md +1 -0
- data/readme.md +4 -0
- data/releases.md +4 -0
- data/template/releases/bake.rb.erb +2 -1
- data.tar.gz.sig +0 -0
- metadata +1 -1
- 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: f1285a821430d0892953c2d45e86f8e5d11fe8d27d8212614ddb87914599370c
|
|
4
|
+
data.tar.gz: f1c4f3edb34b0bbecc4b5cada2286f2572173db3d168d21aa0fd8193dcb60b79
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f75c658d10774d709155f72b2933bcd818cad028d2cff2c80071b1b09f46e9caa3fccc82e3503d988d29d410dd08027887d4bba51d6ace5a5abd4931d2b08434
|
|
7
|
+
data.tar.gz: 35962d24b690a376da309acf3608817cee9340e1d330cf11a589153c445387e1a4e9e390d6b0836b021e5bb9f212878c7eb4a60bcdeedacb28fdce7ca23b0252
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/bake/modernize/license.rb
CHANGED
|
@@ -66,50 +66,7 @@ private
|
|
|
66
66
|
|
|
67
67
|
def update_source_file_authors(authorship, path, modifications)
|
|
68
68
|
copyrights = authorship.copyrights_for_modifications(modifications)
|
|
69
|
-
|
|
70
|
-
input = File.readlines(path)
|
|
71
|
-
output = []
|
|
72
|
-
|
|
73
|
-
if input.first =~ /^\#!/
|
|
74
|
-
output.push input.shift
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
# Drop any old copyright statements.
|
|
78
|
-
while input.first =~ /Copyright/i
|
|
79
|
-
input.shift
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
if input.first =~ /^\#.*?\:/
|
|
83
|
-
output.push input.shift
|
|
84
|
-
if input.first.chomp.empty?
|
|
85
|
-
input.shift
|
|
86
|
-
end
|
|
87
|
-
output << "\n"
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
# Remove any existing license:
|
|
91
|
-
while input.first =~ /^#.*$/
|
|
92
|
-
input.shift
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
# Remove any empty lines:
|
|
96
|
-
while input.first&.chomp&.empty?
|
|
97
|
-
input.shift
|
|
98
|
-
end
|
|
99
|
-
|
|
100
|
-
output << "# Released under the MIT License.\n"
|
|
101
|
-
|
|
102
|
-
copyrights.each do |copyright|
|
|
103
|
-
output << "# #{copyright.statement}\n"
|
|
104
|
-
end
|
|
105
|
-
|
|
106
|
-
output << "\n"
|
|
107
|
-
|
|
108
|
-
output.concat(input)
|
|
109
|
-
|
|
110
|
-
File.open(path, "w") do |file|
|
|
111
|
-
file.puts(output)
|
|
112
|
-
end
|
|
69
|
+
Bake::Modernize::License::SourceFile.update(path, copyrights: copyrights.map(&:statement))
|
|
113
70
|
end
|
|
114
71
|
|
|
115
72
|
def remove_license(readme_path)
|
data/context/getting-started.md
CHANGED
|
@@ -67,7 +67,9 @@ bundle exec bake modernize:releases:github
|
|
|
67
67
|
|
|
68
68
|
This task adds `bake-gem-github` to maintenance dependencies, removes the direct `bake-gem` dependency when present, and updates release notes and Bake hooks. `bake-gem-github` supplies `bake-gem` and `bake-releases` as dependencies. Existing `bake-gem-github` version requirements are preserved.
|
|
69
69
|
|
|
70
|
-
Keep `after_gem_release_version_increment`, which
|
|
70
|
+
Keep `after_gem_release_version_increment`, which runs `modernize:license` to refresh `license.md` and Ruby copyright headers before updating release notes and project documentation. This copyright refresh is included in the generated hook for both `bake-gem` and `bake-gem-github`. When upgrading an existing project, run `bundle exec bake modernize:releases` and review the merged `bake.rb` to include the new call.
|
|
71
|
+
|
|
72
|
+
GitHub publishing replaces the `after_gem_release` call to `releases:github:release`. When merging an existing `bake.rb`, review the generated edit to ensure it removes that call while preserving unrelated custom behavior. Subsequent `modernize:releases` runs select the same template based on the target project's dependencies and do not add the publishing hook back. Contributing instructions also use `gem:github:release:patch` for projects that have adopted it.
|
|
71
73
|
|
|
72
74
|
Configure the release workflows separately using the installed gem's setup task. Pass the actual required CI job names; for example, a repository using the standard Ruby matrix and coverage workflows might use:
|
|
73
75
|
|
|
@@ -12,6 +12,55 @@ module Bake
|
|
|
12
12
|
module License
|
|
13
13
|
GIT_BLAME_IGNORE_REVS = ".git-blame-ignore-revs"
|
|
14
14
|
|
|
15
|
+
# Updates Ruby source headers without removing documentation comments.
|
|
16
|
+
class SourceFile
|
|
17
|
+
MAGIC_COMMENT = /\A#\s*(?:-\*-\s*)?(?:coding|encoding|frozen_string_literal|warn_indent|shareable_constant_value)\s*[:=]/i
|
|
18
|
+
LICENSE_COMMENT = /\A#\s*(?:Released under\b|Copyright\b|SPDX-License-Identifier:)/i
|
|
19
|
+
|
|
20
|
+
# Replace the license and copyright header for a Ruby source file.
|
|
21
|
+
# @parameter path [String] The source file path.
|
|
22
|
+
# @parameter copyrights [Array(String)] The copyright statements to write.
|
|
23
|
+
def self.update(path, copyrights:)
|
|
24
|
+
input = File.readlines(path)
|
|
25
|
+
prefix = []
|
|
26
|
+
|
|
27
|
+
prefix << input.shift if input.first&.start_with?("#!")
|
|
28
|
+
while input.first&.match?(MAGIC_COMMENT)
|
|
29
|
+
prefix << input.shift
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Keep the complete leading comment block, removing only known license metadata.
|
|
33
|
+
documentation = []
|
|
34
|
+
while line = input.first
|
|
35
|
+
break unless line.match?(/\A\s*#/) || line.strip.empty?
|
|
36
|
+
|
|
37
|
+
input.shift
|
|
38
|
+
next if line.match?(LICENSE_COMMENT)
|
|
39
|
+
|
|
40
|
+
documentation << line
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
while documentation.first&.strip&.empty?
|
|
44
|
+
documentation.shift
|
|
45
|
+
end
|
|
46
|
+
while documentation.last&.strip&.empty?
|
|
47
|
+
documentation.pop
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
output = prefix.dup
|
|
51
|
+
output << "\n" if output.any?
|
|
52
|
+
output << "# Released under the MIT License.\n"
|
|
53
|
+
copyrights.each do |copyright|
|
|
54
|
+
output << "# #{copyright}\n"
|
|
55
|
+
end
|
|
56
|
+
output << "\n"
|
|
57
|
+
output.concat(documentation)
|
|
58
|
+
output.concat(input)
|
|
59
|
+
|
|
60
|
+
File.write(path, output.join)
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
15
64
|
# Represents revisions to skip when analyzing authorship.
|
|
16
65
|
class SkipList
|
|
17
66
|
# Load the skip list from a directory.
|
data/license.md
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Copyright, 2020-2026, by Samuel Williams.
|
|
4
4
|
Copyright, 2021-2023, by Olle Jonsson.
|
|
5
5
|
Copyright, 2025, by Copilot.
|
|
6
|
+
Copyright, 2026, by Sampo Kuokkanen.
|
|
6
7
|
|
|
7
8
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
9
|
of this software and associated documentation files (the "Software"), to deal
|
data/readme.md
CHANGED
|
@@ -14,6 +14,10 @@ Please see the [project documentation](https://ioquatix.github.io/bake-modernize
|
|
|
14
14
|
|
|
15
15
|
Please see the [project releases](https://ioquatix.github.io/bake-modernize/releases/index) for all releases.
|
|
16
16
|
|
|
17
|
+
### v0.62.0
|
|
18
|
+
|
|
19
|
+
- Refresh `license.md` and Ruby copyright headers with `modernize:license` after version increments in generated release hooks.
|
|
20
|
+
|
|
17
21
|
### v0.61.0
|
|
18
22
|
|
|
19
23
|
- Provide agent context for updating gems and configuring GitHub releases.
|
data/releases.md
CHANGED
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
# Released under the MIT License.
|
|
4
4
|
# Copyright, 2025-2026, by Samuel Williams.
|
|
5
5
|
|
|
6
|
-
# Update
|
|
6
|
+
# Update copyrights and project documentation for the new version.
|
|
7
7
|
#
|
|
8
8
|
# @parameter version [String] The new version number.
|
|
9
9
|
def after_gem_release_version_increment(version)
|
|
10
|
+
context["modernize:license"].call
|
|
10
11
|
context["releases:update"].call(version)
|
|
11
12
|
context["utopia:project:update"].call
|
|
12
13
|
end
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
|
Binary file
|