yard-fence 0.8.1 → 0.8.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bc262c091f78581d3821583ece2da12cd358b65c7d0acf746d4d6707716e954e
4
- data.tar.gz: '0942c781301e6bd8797d6f2469536f7fb78f9ec94c0925f392dfc3ea4b85291f'
3
+ metadata.gz: 90ced668922aea260b30e6505493afb8bd6b457ad67e598edf5c0a3ca8fec331
4
+ data.tar.gz: 3f177b2d225ca2a737e257b445449206f5d71ca6d307eb90506928bae8e1c0e2
5
5
  SHA512:
6
- metadata.gz: 55f59d786ae901ffce17587bd780277dfad50937d2a4e3ebb3d1c7bd7c20f0509c1ca24ee2de9dd614aa206179bae4919257399d398e5c4b997e2d5874669e72
7
- data.tar.gz: 974da0442ee2e4f4cbb42a7c0cf9100226d05a0ffe58b53a86ee6436bc198dc9807261b44daa9ad5d708a4ee1fbff16ab93c9ed413747e2e7f65340d7cac6ce9
6
+ metadata.gz: eb125c673df6de4eac631cb1678a09a084ec082229dfbd1045975636191823ad2c2ecfb68302ac339885db25294b54e7503ed4ffe980266b222283ca6f836145
7
+ data.tar.gz: cbc8e3b9db77e6267db67b8bb4d266c322382f09667260c0e1cba71fb4ffb39bb309f9ac96ee61d61d1f41d9fed53bae9adbd7ef49cab4343d9a2a2d13016112
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -30,6 +30,38 @@ Please file a bug if you notice a violation of semantic versioning.
30
30
 
31
31
  ### Security
32
32
 
33
+ ## [0.8.2] - 2025-12-30
34
+
35
+ - TAG: [v0.8.2][0.8.2t]
36
+ - COVERAGE: 100.00% -- 130/130 lines in 4 files
37
+ - BRANCH COVERAGE: 100.00% -- 40/40 branches in 4 files
38
+ - 50.00% documented
39
+
40
+ ### Added
41
+
42
+ - `Yard::Fence::RakeTask` - New rake task class that provides `yard:fence:prepare` and `yard:fence:clean` tasks
43
+ - Automatically enhances the `:yard` task when defined
44
+ - Auto-registers when Rake is available at gem load time
45
+ - `Yard::Fence.prepare_for_yard` - New method to prepare for YARD documentation generation
46
+ - Combines `clean_docs_directory` and `prepare_tmp_files` into a single call
47
+ - Intended to be called from rake tasks, not at load time
48
+
49
+ ### Deprecated
50
+
51
+ - `Yard::Fence.at_load_hook` - Now does nothing; use `prepare_for_yard` via rake task instead
52
+
53
+ ### Removed
54
+
55
+ - **BREAKING**: Removed load-time execution of `clean_docs_directory` and `prepare_tmp_files`
56
+ - Previously, these ran when yard-fence was loaded, causing `docs/` to be cleared during unrelated rake tasks like `build` and `release`
57
+ - Now all preparation happens via the `yard:fence:prepare` rake task, which runs as a prerequisite to the `:yard` task
58
+
59
+ ### Fixed
60
+
61
+ - Fixed `docs/` directory being cleared during `rake build` and `rake release` commands
62
+ - The root cause was `at_load_hook` running at gem load time instead of only when generating documentation
63
+ - Now docs cleanup and tmp file preparation only occur when the `yard` task actually runs
64
+
33
65
  ## [0.8.1] - 2025-12-29
34
66
 
35
67
  - TAG: [v0.8.1][0.8.1t]
@@ -150,7 +182,9 @@ Please file a bug if you notice a violation of semantic versioning.
150
182
 
151
183
  - Initial release
152
184
 
153
- [Unreleased]: https://github.com/galtzo-floss/yard-fence/compare/v0.8.1...HEAD
185
+ [Unreleased]: https://github.com/galtzo-floss/yard-fence/compare/v0.8.2...HEAD
186
+ [0.8.2]: https://github.com/galtzo-floss/yard-fence/compare/v0.8.1...v0.8.2
187
+ [0.8.2t]: https://github.com/galtzo-floss/yard-fence/releases/tag/v0.8.2
154
188
  [0.8.1]: https://github.com/galtzo-floss/yard-fence/compare/v0.8.0...v0.8.1
155
189
  [0.8.1t]: https://github.com/galtzo-floss/yard-fence/releases/tag/v0.8.1
156
190
  [0.8.0]: https://github.com/galtzo-floss/yard-fence/compare/v0.7.0...v0.8.0
data/README.md CHANGED
@@ -617,7 +617,7 @@ Thanks for RTFM. ☺️
617
617
  [📌gitmoji]: https://gitmoji.dev
618
618
  [📌gitmoji-img]: https://img.shields.io/badge/gitmoji_commits-%20%F0%9F%98%9C%20%F0%9F%98%8D-34495e.svg?style=flat-square
619
619
  [🧮kloc]: https://www.youtube.com/watch?v=dQw4w9WgXcQ
620
- [🧮kloc-img]: https://img.shields.io/badge/KLOC-0.129-FFDD67.svg?style=for-the-badge&logo=YouTube&logoColor=blue
620
+ [🧮kloc-img]: https://img.shields.io/badge/KLOC-0.130-FFDD67.svg?style=for-the-badge&logo=YouTube&logoColor=blue
621
621
  [🔐security]: SECURITY.md
622
622
  [🔐security-img]: https://img.shields.io/badge/security-policy-259D6C.svg?style=flat
623
623
  [📄copyright-notice-explainer]: https://opensource.stackexchange.com/questions/5778/why-do-licenses-such-as-the-mit-license-specify-a-single-year
@@ -0,0 +1,67 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rake"
4
+ require "rake/tasklib"
5
+
6
+ module Yard
7
+ module Fence
8
+ # Rake task to prepare for YARD documentation generation.
9
+ # This handles both cleaning the docs directory (if YARD_FENCE_CLEAN_DOCS=true)
10
+ # and preparing the tmp/yard-fence files with sanitized markdown.
11
+ #
12
+ # This is separated from the gem's load-time to ensure these operations only
13
+ # happen when explicitly running documentation tasks, not during other
14
+ # rake tasks like `build` or `release`.
15
+ #
16
+ # @example Usage in Rakefile
17
+ # require "yard/fence/rake_task"
18
+ # Yard::Fence::RakeTask.new
19
+ #
20
+ # # This creates a `yard:fence:prepare` task that is automatically added
21
+ # # as a prerequisite to the yard task.
22
+ #
23
+ class RakeTask < ::Rake::TaskLib
24
+ # @return [String] the name of the prepare task (default: "yard:fence:prepare")
25
+ attr_accessor :name
26
+
27
+ # Initialize the rake task.
28
+ #
29
+ # @param name [String, Symbol] the task name (default: "yard:fence:prepare")
30
+ # @yield [task] optional block to configure the task
31
+ def initialize(name = "yard:fence:prepare")
32
+ super()
33
+ @name = name.to_s
34
+
35
+ yield self if block_given?
36
+
37
+ define_tasks
38
+ end
39
+
40
+ private
41
+
42
+ def define_tasks
43
+ namespace(:yard) do
44
+ namespace(:fence) do
45
+ desc("Prepare for YARD documentation (clean docs/, prepare tmp/yard-fence/)")
46
+ task(:prepare) do
47
+ require "yard/fence"
48
+ Yard::Fence.prepare_for_yard
49
+ end
50
+
51
+ # Keep a separate clean task for those who want to clean without preparing
52
+ desc("Clean docs/ directory only (yard-fence)")
53
+ task(:clean) do
54
+ require "yard/fence"
55
+ Yard::Fence.clean_docs_directory
56
+ end
57
+ end
58
+ end
59
+
60
+ # Auto-enhance the yard task if it exists
61
+ if ::Rake::Task.task_defined?(:yard)
62
+ ::Rake::Task[:yard].enhance(["yard:fence:prepare"])
63
+ end
64
+ end
65
+ end
66
+ end
67
+ end
@@ -3,7 +3,7 @@
3
3
  module Yard
4
4
  module Fence
5
5
  module Version
6
- VERSION = "0.8.1"
6
+ VERSION = "0.8.2"
7
7
  end
8
8
  VERSION = Version::VERSION
9
9
  end
data/lib/yard/fence.rb CHANGED
@@ -228,22 +228,36 @@ module Yard
228
228
  puts "[yard/fence] Cleared docs/ directory (YARD_FENCE_CLEAN_DOCS=true)"
229
229
  end
230
230
 
231
- def at_load_hook
231
+ # Prepare for YARD documentation generation.
232
+ # This method should be called from a rake task BEFORE yard runs, not at load time.
233
+ # It cleans the docs directory (if YARD_FENCE_CLEAN_DOCS=true) and prepares tmp files.
234
+ def prepare_for_yard
232
235
  if ENV.fetch("YARD_FENCE_DISABLE", "false").casecmp?("true")
233
236
  # :nocov:
234
- warn("[yard/fence] at_load_hook disabled via YARD_FENCE_DISABLE")
237
+ warn("[yard/fence] prepare_for_yard disabled via YARD_FENCE_DISABLE")
235
238
  # :nocov:
236
239
  else
237
240
  Yard::Fence.clean_docs_directory
238
241
  Yard::Fence.prepare_tmp_files
239
242
  end
240
243
  rescue => e
241
- warn("Yard::Fence: failed to prepare tmp/yard-fence files: #{e.class}: #{e.message}")
244
+ warn("Yard::Fence: failed to prepare for YARD: #{e.class}: #{e.message}")
245
+ end
246
+
247
+ # @deprecated Use prepare_for_yard instead. This method is kept for backward compatibility
248
+ # but does nothing at load time. Call prepare_for_yard from a rake task.
249
+ def at_load_hook
250
+ # INTENTIONALLY EMPTY
251
+ # Previously this ran at load time, but that caused docs/ to be cleared
252
+ # during unrelated rake tasks like `build` and `release`.
253
+ # All preparation now happens via the yard:fence:prepare rake task.
254
+ nil
242
255
  end
243
256
  end
244
257
 
245
- # Execute at load-time so files exist before YARD scans tmp/yard-fence/*.md
246
- Yard::Fence.at_load_hook
258
+ # NOTE: at_load_hook is intentionally NOT called at load time.
259
+ # Use the yard:fence:prepare rake task instead.
260
+ # Yard::Fence.at_load_hook # REMOVED - was causing docs/ to be cleared during `rake build`
247
261
  end
248
262
 
249
263
  # Extend the Version with VersionGem::Basic to provide semantic version helpers.
@@ -251,6 +265,20 @@ Yard::Fence::Version.class_eval do
251
265
  extend VersionGem::Basic
252
266
  end
253
267
 
268
+ # Auto-register rake tasks when Rake is available.
269
+ # This allows upgrading yard-fence to get the fix without also upgrading kettle-dev.
270
+ # The rake task defines yard:fence:prepare which enhances the :yard task if it exists.
271
+ # :nocov:
272
+ if defined?(Rake::Task)
273
+ begin
274
+ require_relative "fence/rake_task"
275
+ Yard::Fence::RakeTask.new unless Rake::Task.task_defined?("yard:fence:prepare")
276
+ rescue LoadError
277
+ # Rake::TaskLib may not be available in all contexts
278
+ end
279
+ end
280
+ # :nocov:
281
+
254
282
  # :nocov:
255
283
  # Not checking coverage of the at_exit hook, because it would require a forked process.
256
284
  unless ENV["YARD_FENCE_SKIP_AT_EXIT"] == "1"
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yard-fence
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter H. Boling
@@ -328,6 +328,7 @@ files:
328
328
  - lib/yard/fence.rb
329
329
  - lib/yard/fence/hoist.rb
330
330
  - lib/yard/fence/kramdown_gfm_document.rb
331
+ - lib/yard/fence/rake_task.rb
331
332
  - lib/yard/fence/version.rb
332
333
  - sig/kramdown.rbs
333
334
  - sig/yard/fence.rbs
@@ -336,10 +337,10 @@ licenses:
336
337
  - MIT
337
338
  metadata:
338
339
  homepage_uri: https://yard-fence.galtzo.com/
339
- source_code_uri: https://github.com/galtzo-floss/yard-fence/tree/v0.8.1
340
- changelog_uri: https://github.com/galtzo-floss/yard-fence/blob/v0.8.1/CHANGELOG.md
340
+ source_code_uri: https://github.com/galtzo-floss/yard-fence/tree/v0.8.2
341
+ changelog_uri: https://github.com/galtzo-floss/yard-fence/blob/v0.8.2/CHANGELOG.md
341
342
  bug_tracker_uri: https://github.com/galtzo-floss/yard-fence/issues
342
- documentation_uri: https://www.rubydoc.info/gems/yard-fence/0.8.1
343
+ documentation_uri: https://www.rubydoc.info/gems/yard-fence/0.8.2
343
344
  funding_uri: https://github.com/sponsors/pboling
344
345
  wiki_uri: https://github.com/galtzo-floss/yard-fence/wiki
345
346
  news_uri: https://www.railsbling.com/tags/yard-fence
metadata.gz.sig CHANGED
Binary file