Class: Ucode::Cli::Audit

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

Overview

─────────────── audit ───────────────

Instance Method Summary collapse

Instance Method Details

#browserObject



415
416
417
418
419
420
421
422
# File 'lib/ucode/cli.rb', line 415

def browser
  result = Commands::Audit::BrowserCommand.new.call(
    input: options[:input],
    faces_only: options[:faces_only],
    library_only: options[:library_only],
  )
  puts JSON.pretty_generate(result_to_h(result))
end

#collection(path) ⇒ Object



333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
# File 'lib/ucode/cli.rb', line 333

def collection(path)
  reference = Ucode::Audit::ReferenceFactory.build_from_cli(
    flag: options[:reference_universal_set],
    version: options[:unicode_version],
  )
  result = Commands::Audit::CollectionCommand.new.call(
    path,
    font_index: options[:font_index],
    label: options[:label],
    unicode_version: options[:unicode_version],
    verbose: options[:verbose],
    with_glyphs: options[:with_glyphs],
    brief: options[:brief],
    output_root: options[:output],
    browse: options[:browse],
    reference: reference,
    universal_set_root: options[:universal_set_root],
    with_missing_glyph_pages: options[:with_missing_glyph_pages],
  )
  puts JSON.pretty_generate(result_to_h(result))
end

#compare(left, right) ⇒ Object



395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
# File 'lib/ucode/cli.rb', line 395

def compare(left, right)
  result = Commands::Audit::CompareCommand.new.call(
    left, right,
    unicode_version: options[:unicode_version],
    output_file: options[:output],
  )
  if result.error
    warn "compare failed: #{result.error}"
    exit 1
  elsif options[:output].nil?
    puts result.text
  else
    puts "wrote #{options[:output]}"
  end
end

#font(path) ⇒ Object



295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
# File 'lib/ucode/cli.rb', line 295

def font(path)
  reference = Ucode::Audit::ReferenceFactory.build_from_cli(
    flag: options[:reference_universal_set],
    version: options[:unicode_version],
  )
  result = Commands::Audit::FontCommand.new.call(
    path,
    label: options[:label],
    unicode_version: options[:unicode_version],
    verbose: options[:verbose],
    with_glyphs: options[:with_glyphs],
    brief: options[:brief],
    output_root: options[:output],
    browse: options[:browse],
    install: !options[:no_install],
    reference: reference,
    universal_set_root: options[:universal_set_root],
    with_missing_glyph_pages: options[:with_missing_glyph_pages],
  )
  puts JSON.pretty_generate(result_to_h(result))
end

#library(dir) ⇒ Object



370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
# File 'lib/ucode/cli.rb', line 370

def library(dir)
  reference = Ucode::Audit::ReferenceFactory.build_from_cli(
    flag: options[:reference_universal_set],
    version: options[:unicode_version],
  )
  result = Commands::Audit::LibraryCommand.new.call(
    dir,
    recursive: options[:recursive],
    unicode_version: options[:unicode_version],
    verbose: options[:verbose],
    with_glyphs: options[:with_glyphs],
    brief: options[:brief],
    output_root: options[:output],
    browse: options[:browse],
    reference: reference,
    universal_set_root: options[:universal_set_root],
    with_missing_glyph_pages: options[:with_missing_glyph_pages],
  )
  puts JSON.pretty_generate(result_to_h(result))
end