Class: Fontisan::Commands::AuditCompareCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/fontisan/commands/audit_compare_command.rb

Overview

Diffs two faces or two saved audit reports.

Each input is one of:

- A path to a `.yaml`/`.json` file previously written by
`fontisan audit -o`. Loaded as an AuditReport.
- A path to a font file. Audited on-the-fly via AuditCommand.

Returns an Models::Audit::AuditDiff. The CLI renders it as YAML/JSON (text formatter lands in TODO 25).

Mixed inputs are allowed (font vs. saved report), which is useful for tracking a font's evolution against a checked-in baseline.

Instance Method Summary collapse

Constructor Details

#initialize(left_path, right_path, options = {}) ⇒ AuditCompareCommand

Returns a new instance of AuditCompareCommand.

Parameters:

  • left_path (String)

    path to font file or saved report

  • right_path (String)

    path to font file or saved report

  • options (Hash) (defaults to: {})

    forwarded to AuditCommand for any input that needs to be audited fresh



22
23
24
25
26
# File 'lib/fontisan/commands/audit_compare_command.rb', line 22

def initialize(left_path, right_path, options = {})
  @left_path = left_path
  @right_path = right_path
  @options = options
end

Instance Method Details

#runModels::Audit::AuditDiff



29
30
31
32
33
# File 'lib/fontisan/commands/audit_compare_command.rb', line 29

def run
  left_report = load_report(@left_path)
  right_report = load_report(@right_path)
  Audit::Differ.new(left_report, right_report).diff
end