yard-timekeeper 0.2.3 → 0.2.4
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 +16 -1
- data/README.md +1 -1
- data/lib/yard/timekeeper/version.rb +1 -1
- data/lib/yard/timekeeper.rb +75 -6
- data.tar.gz.sig +0 -0
- metadata +5 -5
- 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: e09988dc7f2aa7fbd159d09194aad1c6c8b0fd7108d2a2ed36c28a904783bcea
|
|
4
|
+
data.tar.gz: bf3b8b0ddf8b4306a88ba82c676411677ecd142326c6e3678145c0b9e5d45514
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e6b6fc80c60947b4ae41e30cbba483e07739294eb04814e2423e0ec704d29f76e3e8b8d3ce3460baf09859c6d0553568bcdb3a404db047a0b4d1a8f202a73958
|
|
7
|
+
data.tar.gz: 12f546cff001d872c891914ef9c76a6da879ed8b1d6a57441d9c79cfcc9291c0ebacf9b73f97746638f253f1d5c23e6b3b791f04f2db9fe8801e368b4ad5fb4e
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/CHANGELOG.md
CHANGED
|
@@ -30,6 +30,19 @@ Please file a bug if you notice a violation of semantic versioning.
|
|
|
30
30
|
|
|
31
31
|
### Security
|
|
32
32
|
|
|
33
|
+
## [0.2.4] - 2026-07-18
|
|
34
|
+
|
|
35
|
+
- TAG: [v0.2.4][0.2.4t]
|
|
36
|
+
- COVERAGE: 95.20% -- 119/125 lines in 3 files
|
|
37
|
+
- BRANCH COVERAGE: 86.54% -- 45/52 branches in 3 files
|
|
38
|
+
- 15.62% documented
|
|
39
|
+
|
|
40
|
+
### Fixed
|
|
41
|
+
|
|
42
|
+
- Restored generated YARD title/header metadata from git when rebuilding docs
|
|
43
|
+
with a newer YARD version, including when the file also has real content
|
|
44
|
+
changes that should be preserved.
|
|
45
|
+
|
|
33
46
|
## [0.2.3] - 2026-07-02
|
|
34
47
|
|
|
35
48
|
- TAG: [v0.2.3][0.2.3t]
|
|
@@ -119,7 +132,9 @@ Please file a bug if you notice a violation of semantic versioning.
|
|
|
119
132
|
|
|
120
133
|
- Initial release
|
|
121
134
|
|
|
122
|
-
[Unreleased]: https://github.com/galtzo-floss/yard-timekeeper/compare/v0.2.
|
|
135
|
+
[Unreleased]: https://github.com/galtzo-floss/yard-timekeeper/compare/v0.2.4...HEAD
|
|
136
|
+
[0.2.4]: https://github.com/galtzo-floss/yard-timekeeper/compare/v0.2.3...v0.2.4
|
|
137
|
+
[0.2.4t]: https://github.com/galtzo-floss/yard-timekeeper/releases/tag/v0.2.4
|
|
123
138
|
[0.2.3]: https://github.com/galtzo-floss/yard-timekeeper/compare/v0.2.2...v0.2.3
|
|
124
139
|
[0.2.3t]: https://github.com/galtzo-floss/yard-timekeeper/releases/tag/v0.2.3
|
|
125
140
|
[0.2.2]: https://github.com/galtzo-floss/yard-timekeeper/compare/v0.2.1...v0.2.2
|
data/README.md
CHANGED
|
@@ -540,7 +540,7 @@ Thanks for RTFM. ☺️
|
|
|
540
540
|
[📌gitmoji]: https://gitmoji.dev
|
|
541
541
|
[📌gitmoji-img]: https://img.shields.io/badge/gitmoji_commits-%20%F0%9F%98%9C%20%F0%9F%98%8D-34495e.svg?style=flat-square
|
|
542
542
|
[🧮kloc]: https://www.youtube.com/watch?v=dQw4w9WgXcQ
|
|
543
|
-
[🧮kloc-img]: https://img.shields.io/badge/KLOC-0.
|
|
543
|
+
[🧮kloc-img]: https://img.shields.io/badge/KLOC-0.125-FFDD67.svg?style=for-the-badge&logo=YouTube&logoColor=blue
|
|
544
544
|
[🔐security]: https://github.com/galtzo-floss/yard-timekeeper/blob/main/SECURITY.md
|
|
545
545
|
[🔐security-img]: https://img.shields.io/badge/security-policy-259D6C.svg?style=flat
|
|
546
546
|
[📄copyright-notice-explainer]: https://opensource.stackexchange.com/questions/5778/why-do-licenses-such-as-the-mit-license-specify-a-single-year
|
data/lib/yard/timekeeper.rb
CHANGED
|
@@ -14,13 +14,22 @@ module Yard
|
|
|
14
14
|
RAKE_INTEGRATIONS = {}
|
|
15
15
|
RAKE_INTEGRATIONS_MUTEX = Mutex.new
|
|
16
16
|
|
|
17
|
+
TITLE_GENERATOR_DIFF_LINE_RE = /\A[+-].*Documentation by YARD \d+(?:\.\d+)+(?:[.\w-][.\w-]*)?\s*\z/
|
|
17
18
|
TIMESTAMP_DIFF_LINE_RE = /\A[+-]\s{2}Generated on .+ by\s*\z/
|
|
18
|
-
|
|
19
|
+
FOOTER_GENERATOR_VERSION_DIFF_LINE_RE = /
|
|
19
20
|
\A[+-]\s{2}
|
|
20
21
|
\d+(?:\.\d+)+(?:[.\w-][.\w-]*)?
|
|
21
22
|
\s\(ruby-[^)]+\)\.\s*
|
|
22
23
|
\z
|
|
23
24
|
/x
|
|
25
|
+
TITLE_GENERATOR_LINE_RE = /Documentation by YARD \d+(?:\.\d+)+(?:[.\w-][.\w-]*)?/
|
|
26
|
+
TIMESTAMP_LINE_RE = /\A\s{2}Generated on .+ by\s*\z/
|
|
27
|
+
FOOTER_GENERATOR_VERSION_LINE_RE = /
|
|
28
|
+
\A\s{2}
|
|
29
|
+
\d+(?:\.\d+)+(?:[.\w-][.\w-]*)?
|
|
30
|
+
\s\(ruby-[^)]+\)\.\s*
|
|
31
|
+
\z
|
|
32
|
+
/x
|
|
24
33
|
DIFF_METADATA_PREFIXES = [
|
|
25
34
|
"diff --git ",
|
|
26
35
|
"index ",
|
|
@@ -41,9 +50,12 @@ module Yard
|
|
|
41
50
|
|
|
42
51
|
changed_docs_files(root).each do |relative_path|
|
|
43
52
|
next unless relative_path.end_with?(".html")
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
53
|
+
diff = git_diff(relative_path, root)
|
|
54
|
+
if timestamp_only_diff?(diff)
|
|
55
|
+
restore_file(relative_path, root)
|
|
56
|
+
else
|
|
57
|
+
normalize_generated_metadata(relative_path, root)
|
|
58
|
+
end
|
|
47
59
|
end
|
|
48
60
|
rescue => e
|
|
49
61
|
warn("Yard::Timekeeper.postprocess_html_docs failed: #{e.class}: #{e.message}")
|
|
@@ -126,7 +138,9 @@ module Yard
|
|
|
126
138
|
end
|
|
127
139
|
|
|
128
140
|
def footer_churn_line?(line)
|
|
129
|
-
line.match?(
|
|
141
|
+
line.match?(TITLE_GENERATOR_DIFF_LINE_RE) ||
|
|
142
|
+
line.match?(TIMESTAMP_DIFF_LINE_RE) ||
|
|
143
|
+
line.match?(FOOTER_GENERATOR_VERSION_DIFF_LINE_RE)
|
|
130
144
|
end
|
|
131
145
|
|
|
132
146
|
def balanced_footer_churn?(change_lines)
|
|
@@ -140,12 +154,67 @@ module Yard
|
|
|
140
154
|
end
|
|
141
155
|
|
|
142
156
|
def footer_churn_kind(line)
|
|
157
|
+
return :title_generator if line.match?(TITLE_GENERATOR_DIFF_LINE_RE)
|
|
143
158
|
return :timestamp if line.match?(TIMESTAMP_DIFF_LINE_RE)
|
|
144
|
-
return :
|
|
159
|
+
return :footer_generator_version if line.match?(FOOTER_GENERATOR_VERSION_DIFF_LINE_RE)
|
|
145
160
|
|
|
146
161
|
:unknown
|
|
147
162
|
end
|
|
148
163
|
|
|
164
|
+
def normalize_generated_metadata(path, root)
|
|
165
|
+
original = tracked_file_content(path, root)
|
|
166
|
+
return false unless original
|
|
167
|
+
|
|
168
|
+
absolute_path = File.join(root, path)
|
|
169
|
+
return false unless File.file?(absolute_path)
|
|
170
|
+
|
|
171
|
+
replacement_lines = generated_metadata_lines(original)
|
|
172
|
+
return false if replacement_lines.empty?
|
|
173
|
+
|
|
174
|
+
current = File.read(absolute_path)
|
|
175
|
+
changed = false
|
|
176
|
+
normalized_lines = current.lines.map do |line|
|
|
177
|
+
kind = generated_metadata_kind(line)
|
|
178
|
+
replacement = replacement_lines[kind]
|
|
179
|
+
if replacement && line != replacement
|
|
180
|
+
changed = true
|
|
181
|
+
replacement
|
|
182
|
+
else
|
|
183
|
+
line
|
|
184
|
+
end
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
return false unless changed
|
|
188
|
+
|
|
189
|
+
File.write(absolute_path, normalized_lines.join)
|
|
190
|
+
true
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
def tracked_file_content(path, root)
|
|
194
|
+
stdout, status = Open3.capture2("git", "show", "HEAD:#{path}", chdir: root)
|
|
195
|
+
return unless status.success?
|
|
196
|
+
|
|
197
|
+
stdout
|
|
198
|
+
rescue Errno::ENOENT
|
|
199
|
+
nil
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
def generated_metadata_lines(content)
|
|
203
|
+
content.lines.each_with_object({}) do |line, replacements|
|
|
204
|
+
kind = generated_metadata_kind(line)
|
|
205
|
+
replacements[kind] ||= line if kind
|
|
206
|
+
end
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
def generated_metadata_kind(line)
|
|
210
|
+
stripped_line = line.strip
|
|
211
|
+
return :title_generator if stripped_line.match?(TITLE_GENERATOR_LINE_RE)
|
|
212
|
+
return :timestamp if line.match?(TIMESTAMP_LINE_RE)
|
|
213
|
+
return :footer_generator_version if line.match?(FOOTER_GENERATOR_VERSION_LINE_RE)
|
|
214
|
+
|
|
215
|
+
nil
|
|
216
|
+
end
|
|
217
|
+
|
|
149
218
|
def restore_file(path, root)
|
|
150
219
|
_stdout, _stderr, status = Open3.capture3("git", "checkout", "--", path, chdir: root)
|
|
151
220
|
status.success?
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: yard-timekeeper
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Peter H. Boling
|
|
@@ -279,10 +279,10 @@ licenses:
|
|
|
279
279
|
- MIT
|
|
280
280
|
metadata:
|
|
281
281
|
homepage_uri: https://yard-timekeeper.galtzo.com
|
|
282
|
-
source_code_uri: https://github.com/galtzo-floss/yard-timekeeper/tree/v0.2.
|
|
283
|
-
changelog_uri: https://github.com/galtzo-floss/yard-timekeeper/blob/v0.2.
|
|
282
|
+
source_code_uri: https://github.com/galtzo-floss/yard-timekeeper/tree/v0.2.4
|
|
283
|
+
changelog_uri: https://github.com/galtzo-floss/yard-timekeeper/blob/v0.2.4/CHANGELOG.md
|
|
284
284
|
bug_tracker_uri: https://github.com/galtzo-floss/yard-timekeeper/issues
|
|
285
|
-
documentation_uri: https://www.rubydoc.info/gems/yard-timekeeper/0.2.
|
|
285
|
+
documentation_uri: https://www.rubydoc.info/gems/yard-timekeeper/0.2.4
|
|
286
286
|
funding_uri: https://github.com/sponsors/pboling
|
|
287
287
|
wiki_uri: https://github.com/galtzo-floss/yard-timekeeper/wiki
|
|
288
288
|
news_uri: https://www.railsbling.com/tags/yard-timekeeper
|
|
@@ -312,7 +312,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
312
312
|
- !ruby/object:Gem::Version
|
|
313
313
|
version: '0'
|
|
314
314
|
requirements: []
|
|
315
|
-
rubygems_version: 4.0.
|
|
315
|
+
rubygems_version: 4.0.16
|
|
316
316
|
specification_version: 4
|
|
317
317
|
summary: "\U0001F570️ Preserve tracked YARD docs when only the generated timestamp
|
|
318
318
|
changed."
|
metadata.gz.sig
CHANGED
|
Binary file
|