Skip to content

Commit c5b9eb8

Browse files
committed
v0.2.0: Canonical block synchronization and source skimming features
This merge combines all feature development from the dev/0.2 branch into a single canonical update for v0.2.0. Highlights include the new `Sourcerer::Sync` engine, the `Sourcerer::SourceSkim` document inspection API, and utilities for inferring paths from strings and for runtime amendment of `Array<String>` lists. - **Sourcerer::Sync**: A new engine for synchronizing content blocks between template sources and target files using configurable tag markers. Includes: - `BlockParser`: Format-agnostic tagged-region parser supporting AsciiDoc, Ruby, Shell, and HTML comments. - `Cast`: Operations for initializing new files from Liquid templates or updating existing blocks. - Support for "canonical prefixes" (e.g., `universal-`) to distinguish managed content. - **Sourcerer::SourceSkim**: A machine-oriented document inspection API that produces structured representations of AsciiDoc source files. - Extracts section hierarchies (tree or flat), attributes, images, includes, tables, and blocks. - Includes an `Asciidoctor::TreeProcessor` extension for integration into generic conversion pipelines. - SChema and sample file added to help tools infer skim output structure: - `specs/data/asciidoc-source-skim-model.yaml` (representative structure w/ comments) - `specs/data/asciidoc-source-skim.schema.json` (JSON Schema definition of full skim output) - **Two Example Scripts**: New CLI utilities (`scripts/mark_down_grade.rb` and `scripts/skim_asciidoc.rb`). - `Sourcerer::Util::Pathifier`: Unified path resolution supporting files, directories (with recursive search), and glob patterns. - `Sourcerer::Util::ListAmend`: Implements a +/- amendment syntax for merging user-supplied lists into library defaults. - `Sourcerer::AttributesFilter`: Shared utility for partitioning builtin vs. user-defined Asciidoctor attributes. - Version bumped 0.1.0 -> 0.2.0. - Added `AsciiSourcerer::Sync` alias for namespace parity. - Updated main `Sourcerer` facade with new autoloads and logic. - Comprehensive test suite expansion (approx. 150+ new RSpec examples). - 17-example `block_parser_spec.rb` and 23-example `cast_spec.rb` added. - 5 fixture files added under `specs/tests/fixtures/sync/`. - `ascii_sourcerer_alias_spec.rb` version assertion updated to `0.2.0`. - RuboCop baseline updated for new modules. - README.adoc updated with new documentation for all features. - Existing Bash scripts updated with proper shebang statments.
1 parent 165f454 commit c5b9eb8

36 files changed

Lines changed: 3955 additions & 51 deletions

.config/rubocop.yml

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,32 @@ Metrics/ModuleLength:
1717
- lib/sourcerer/asciidoc.rb
1818
- lib/sourcerer/mark_down_grade.rb
1919
- lib/sourcerer/rendering.rb
20+
- lib/sourcerer/sync/block_parser.rb # intentionally full; barely over
2021

2122
Metrics/ClassLength:
2223
Exclude:
2324
- lib/sourcerer/mark_down_grade.rb
25+
- lib/sourcerer/source_skim/skimmer.rb
26+
- lib/sourcerer/sync/cast.rb # no advantage to splitting
2427

2528
Metrics/MethodLength:
2629
Exclude:
2730
- lib/sourcerer/asciidoc.rb
2831
- lib/sourcerer/jekyll/monkeypatches.rb
2932
- lib/sourcerer/mark_down_grade.rb
33+
- lib/sourcerer/source_skim/skimmer.rb
34+
# BlockParser.parse is a single-pass parser; extracting sub-steps into private
35+
# helpers would obscure the algorithm without reducing real complexity.
36+
- lib/sourcerer/sync/block_parser.rb # abstraction would obscure algorithm
37+
- lib/sourcerer/sync/cast.rb # splitting adds indirection w/out clarity gains.
38+
39+
Metrics/ParameterLists:
40+
Exclude:
41+
# BlockParser.parse + Cast.sync/Cast.initialize options are independently
42+
# documented public API params; grouping into options hash would reduce
43+
# discoverability.
44+
- lib/sourcerer/sync/block_parser.rb
45+
- lib/sourcerer/sync/cast.rb
3046

3147
RSpec/SpecFilePathFormat:
3248
CustomTransform:
@@ -35,8 +51,16 @@ RSpec/SpecFilePathFormat:
3551
AsciiDoc: asciidoc
3652
PlainTextConverter: plaintext_converter
3753

38-
# Integration test of alias mechanism requires coupled assertions
39-
# to verify both namespaces work identically as a complete feature
4054
RSpec/MultipleExpectations:
55+
# Sync specs test stateful operations (file writes, parse results) where
56+
# grouping 2-4 closely related assertions per example aids readability.
57+
Max: 4
4158
Exclude:
59+
# Integration test of alias mechanism requires coupled assertions
60+
# to verify both namespaces work identically as a complete feature
4261
- specs/tests/rspec/ascii_sourcerer_alias_spec.rb
62+
63+
RSpec/ExampleLength:
64+
# Sync integration examples require inline heredoc fixtures plus the assertions
65+
# that exercise them; extracting to let blocks rarely improves clarity here.
66+
Max: 15

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
asciisourcerer (0.1.0)
4+
asciisourcerer (0.2.0)
55
asciidoctor (~> 2.0)
66
asciidoctor-html5s (~> 0.5)
77
jekyll (~> 4.4)

0 commit comments

Comments
 (0)