Class: Ucode::Commands::UniversalSet::BuildCommand

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

Overview

ucode universal-set build action class. Pure Ruby — Thor (in lib/ucode/cli.rb) is responsible only for argument parsing and dispatch.

Instance Method Summary collapse

Instance Method Details

#call(version, output_root:, source_config_path: nil, resolver: nil, block_filter: nil, parallel_workers: default_workers, skip_pre_check: false) ⇒ Hash

Returns { version:, manifest_path:, totals:, by_tier:, coverage:, validation: }.

Parameters:

  • version (String)

    resolved UCD version

  • output_root (String, Pathname)

    directory that will hold manifest.json, glyphs/, reports/.

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

    override the Tier 1 font config YAML; nil uses the default at Ucode::Glyphs::SourceConfig::DEFAULT_PATH.

  • resolver (Ucode::Glyphs::Resolver, nil) (defaults to: nil)

    inject a pre-built resolver (skips SourceBuilder + PreBuildCheck); used by tests.

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

    limit the build to one block (canonical underscore form). Useful for partial rebuilds when iterating on Tier 1 curation.

  • parallel_workers (Integer) (defaults to: default_workers)

    forwarded to the Builder. Defaults to Ucode::Configuration#parallel_workers.

  • skip_pre_check (Boolean) (defaults to: false)

    when true, skip the PreBuildCheck step. Used by tests that inject a custom resolver and don't have a real source config on disk.

Returns:

  • (Hash)

    { version:, manifest_path:, totals:, by_tier:, coverage:, validation: }



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
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/ucode/commands/universal_set.rb', line 61

def call(version, output_root:, source_config_path: nil,
         resolver: nil, block_filter: nil,
         parallel_workers: default_workers, skip_pre_check: false)
  root = Pathname.new(output_root)

  config_path = source_config_path_or_default(source_config_path)
  sha = source_config_sha256(config_path)
  database = Database.open(version)

  run_pre_check(config_path, database) unless skip_pre_check

  resolved_resolver = resolver || build_resolver(version, config_path, database)

  builder = Glyphs::UniversalSet::Builder.new(
    output_root: root,
    resolver: resolved_resolver,
    unicode_version: version,
    ucode_version: Ucode::VERSION,
    source_config_sha256: sha,
    parallel_workers: parallel_workers,
    block_filter: block_filter,
  )

  manifest_path = builder.build(codepoint_enum(version))

  manifest = Ucode::Models::UniversalSetManifest.from_hash(
    JSON.parse(manifest_path.read),
  )
  coverage = Glyphs::UniversalSet::CoverageReport
    .new(root, database: database).emit(manifest)
  validation = Glyphs::UniversalSet::Validator
    .new(root, unicode_version: version).validate
  {
    version: version,
    manifest_path: manifest_path,
    totals: manifest.totals.to_hash,
    by_tier: manifest.by_tier,
    coverage: coverage,
    validation: validation,
  }
end