Class: Ucode::Commands::Audit::LibraryCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/ucode/commands/audit/library_command.rb

Overview

ucode audit library DIR — walk a directory of fonts and produce one per-face audit plus a library-level rollup.

Delegates directory walking + per-face audit to Audit::LibraryAuditor, then writes the per-face trees + library-level index.json via Audit::Emitter::FaceDirectory.

Defined Under Namespace

Classes: Result, SkippedFile

Instance Method Summary collapse

Instance Method Details

#call(dir, output_root:, recursive: false, unicode_version: nil, verbose: false, with_glyphs: false, brief: false, browse: false, reference: nil, universal_set_root: nil, with_missing_glyph_pages: false) ⇒ Result

Parameters:

  • dir (String, Pathname)

    directory containing fonts.

  • recursive (Boolean) (defaults to: false)

    walk subdirectories.

  • unicode_version (String, nil) (defaults to: nil)

    baseline UCD version.

  • verbose (Boolean) (defaults to: false)

    per-codepoint detail chunks per face.

  • with_glyphs (Boolean) (defaults to: false)

    per-codepoint SVG chunks.

  • brief (Boolean) (defaults to: false)

    cheap-extractor-only mode.

  • output_root (String, Pathname)

    parent of the audit root.

  • browse (Boolean) (defaults to: false)

    also write library + face HTML browsers.

  • reference (Ucode::Audit::CoverageReference, nil) (defaults to: nil)

    baseline forwarded to every per-face audit (TODO 25).

  • universal_set_root (String, Pathname, nil) (defaults to: nil)

    forwarded to Emitter::FaceDirectory for the face browser's universal-set section (TODO 26).

  • with_missing_glyph_pages (Boolean) (defaults to: false)

    emit per-block standalone missing-glyph galleries per face (TODO 26).

Returns:



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/ucode/commands/audit/library_command.rb', line 41

def call(dir, output_root:, recursive: false, unicode_version: nil, verbose: false,
         with_glyphs: false, brief: false, browse: false, reference: nil,
         universal_set_root: nil, with_missing_glyph_pages: false)
  options = library_options(unicode_version: unicode_version, brief: brief)
  auditor = Ucode::Audit::LibraryAuditor.new(dir, recursive: recursive,
                                                  options: options,
                                                  reference: reference)
  summary = auditor.audit

  directory = Ucode::Audit::Emitter::FaceDirectory.new(
    output_root: output_root,
    verbose: verbose,
    with_glyphs: with_glyphs,
    emit_browser: browse,
    universal_set_root: universal_set_root,
    with_missing_glyph_pages: with_missing_glyph_pages,
  )
  directory.emit_library(summary: summary)

  Result.new(
    root: dir.to_s,
    total_files: summary.total_files,
    total_faces: summary.total_faces,
    output_dir: Ucode::Audit::Emitter::Paths.library_root(output_root).to_s,
    skipped: auditor.skipped.map { |s| parse_skipped(s) },
  )
rescue StandardError => e
  Result.new(root: dir.to_s, error: "#{e.class}: #{e.message}")
end