Class: Ucode::Audit::Emitter::LibraryEmitter
- Inherits:
-
Object
- Object
- Ucode::Audit::Emitter::LibraryEmitter
- Includes:
- Repo::AtomicWrites
- Defined in:
- lib/ucode/audit/emitter/library_emitter.rb
Overview
Writes output/font_audit/index.json — the library-mode
top-level index pointing at each face's index.json.
Aggregates the per-face Models::Audit::LibrarySummary into a compact card list. The browser fetches this once on load and uses the cards to render the library browser; clicking a card fetches that face's per-face directory.
Instance Method Summary collapse
-
#build_index(summary) ⇒ Hash
Build the library index.json shape (a Hash).
-
#emit(output_root, summary) ⇒ Boolean
True if written, false if skipped.
Methods included from Repo::AtomicWrites
#same_content?, #to_pretty_json, #write_atomic
Instance Method Details
#build_index(summary) ⇒ Hash
Build the library index.json shape (a Hash). Exposed so the HTML browser (Browser::LibraryPage) can reuse the exact same shape when inlining overview data into its template.
36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/ucode/audit/emitter/library_emitter.rb', line 36 def build_index(summary) { "root_path" => summary.root_path, "total_files" => summary.total_files, "total_faces" => summary.total_faces, "scanned_extensions" => summary.scanned_extensions, "aggregate_metrics" => summary.aggregate_metrics, "license_distribution" => summary.license_distribution, "duplicate_groups" => summary.duplicate_groups.map(&:to_hash), "script_coverage" => summary.script_coverage.map(&:to_hash), "faces" => face_cards(summary), } end |
#emit(output_root, summary) ⇒ Boolean
Returns true if written, false if skipped.
24 25 26 27 28 |
# File 'lib/ucode/audit/emitter/library_emitter.rb', line 24 def emit(output_root, summary) path = Paths.library_index_path(output_root) payload = to_pretty_json(build_index(summary)) write_atomic(path, payload) end |