Class: Ucode::Commands::ReleaseCommand

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

Overview

ucode release — assemble the fontist.org-consumable release tree (TODO 27).

Walks a directory of per-formula font subdirectories, audits each via Audit::LibraryAuditor, and passes the resulting Audit::Release::FormulaAudits list to Audit::Release::Emitter.

The release tree lives at <output_root>/font_audit_release/. The CI collector job invokes this after matrix-auditing every formula and pre-staging the universal-set directory.

Defined Under Namespace

Classes: FormulaSource, Result

Instance Method Summary collapse

Instance Method Details

#call(from:, output_root:, universal_set_root: nil, unicode_version: nil, recursive: true, brief: false, browse: true, source_config_sha256: nil, reference: nil, generated_at: Time.now.utc.iso8601) ⇒ Result

Parameters:

  • from (String, Pathname)

    directory containing one subdirectory per formula. Each subdirectory's name becomes the formula slug; its contents are audited via Audit::LibraryAuditor (recursive walk).

  • output_root (String, Pathname)

    parent of the release root. Release tree lives at <output_root>/font_audit_release/.

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

    location of the universal_glyph_set directory. Defaults to <release_root>/universal_glyph_set inside the release tree.

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

    baseline UCD version.

  • recursive (Boolean) (defaults to: true)

    recursively walk each formula subdirectory. Default true.

  • brief (Boolean) (defaults to: false)

    cheap-extractor-only audit mode.

  • browse (Boolean) (defaults to: true)

    also emit per-face HTML browsers.

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

    sha256 of the Tier 1 source-config YAML (TODO 23). Recorded in the manifest for curation provenance.

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

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

  • generated_at (String) (defaults to: Time.now.utc.iso8601)

    ISO8601 timestamp. Default: now.

Returns:



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/ucode/commands/release.rb', line 53

def call(from:, output_root:, universal_set_root: nil, unicode_version: nil,
         recursive: true, brief: false, browse: true,
         source_config_sha256: nil, reference: nil,
         generated_at: Time.now.utc.iso8601)
  formula_sources = discover_formulas(from)
  formulas = formula_sources.map do |src|
    summary = audit_formula(src.path, recursive: recursive,
                                      unicode_version: unicode_version,
                                      brief: brief, reference: reference)
    Ucode::Audit::Release::FormulaAudits.new(slug: src.slug, summary: summary)
  end

  emitter = Ucode::Audit::Release::Emitter.new(
    output_root: output_root,
    universal_set_root: universal_set_root,
    with_missing_glyph_pages: browse,
  )
  emit_result = emitter.emit(
    formulas: formulas,
    unicode_version: unicode_version,
    generated_at: generated_at,
    source_config_sha256: source_config_sha256,
  )

  Result.new(
    release_root: emit_result.release_root,
    formulas_total: emit_result.formulas_total,
    faces_total: emit_result.faces_total,
    formulas: formula_sources,
    universal_set_available: emit_result.universal_set_available,
    library_index_written: emit_result.library_index_written,
    manifest_written: emit_result.manifest_written,
  )
rescue StandardError => e
  Result.new(error: "#{e.class}: #{e.message}")
end