Class: Ucode::Cli::UniversalSetCmd

Inherits:
Thor
  • Object
show all
Defined in:
lib/ucode/cli.rb

Overview

─────────────── universal-set ───────────────

Instance Method Summary collapse

Instance Method Details

#build(version = nil) ⇒ Object



450
451
452
453
454
455
456
457
458
459
460
461
462
463
# File 'lib/ucode/cli.rb', line 450

def build(version = nil)
  result = Commands::UniversalSet::BuildCommand.new.call(
    VersionResolver.resolve(version),
    output_root: options[:to],
    source_config_path: options[:source_config],
    block_filter: options[:block],
    parallel_workers: options[:parallel] || Ucode.configuration.parallel_workers,
  )
  puts JSON.pretty_generate(result)
rescue Ucode::UniversalSetPreBuildError => e
  warn "pre-build validation failed:"
  warn JSON.pretty_generate(e.context)
  exit 1
end

#pre_check(version = nil) ⇒ Object



468
469
470
471
472
473
474
475
476
477
478
# File 'lib/ucode/cli.rb', line 468

def pre_check(version = nil)
  report = Commands::UniversalSet::PreCheckCommand.new.call(
    VersionResolver.resolve(version),
    source_config_path: options[:source_config],
  )
  puts JSON.pretty_generate(report.to_h)
rescue Ucode::UniversalSetPreBuildError => e
  warn "pre-build validation failed:"
  warn JSON.pretty_generate(e.context)
  exit 1
end

#report(version = nil) ⇒ Object



483
484
485
486
487
488
489
# File 'lib/ucode/cli.rb', line 483

def report(version = nil)
  result = Commands::UniversalSet::ReportCommand.new.call(
    VersionResolver.resolve(version),
    output_root: options[:from],
  )
  puts JSON.pretty_generate(result)
end

#validate(output_root = "./output/universal_glyph_set") ⇒ Object



494
495
496
497
498
499
500
501
# File 'lib/ucode/cli.rb', line 494

def validate(output_root = "./output/universal_glyph_set")
  result = Commands::UniversalSet::ValidateCommand.new.call(
    output_root,
    version: options[:version] && VersionResolver.resolve(options[:version]),
  )
  puts JSON.pretty_generate(result)
  exit 1 unless result[:passed]
end