Class: Ucode::Commands::Audit::BrowserCommand

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

Overview

ucode audit browser — regenerate HTML browsers from existing JSON audits, without re-running extractors.

Walks the audit root and rewrites only .html files. Useful when the audit ran without --browse, or after a CSS/JS template tweak. No JSON is rewritten.

Scopes:

- default: regenerate both library-level + all face pages.
- `faces_only: true` — only per-face pages.
- `library_only: true` — only the library-level page.

Defined Under Namespace

Classes: FaceRegen, Result

Instance Method Summary collapse

Instance Method Details

#call(input:, faces_only: false, library_only: false) ⇒ Result

Parameters:

  • input (String, Pathname)

    audit root path. Must be a directory containing either <input>/index.json (library root) or per-face subdirectories each with their own index.json (face root). Either way the root is treated as the library root.

  • faces_only (Boolean) (defaults to: false)
  • library_only (Boolean) (defaults to: false)

Returns:



38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/ucode/commands/audit/browser_command.rb', line 38

def call(input:, faces_only: false, library_only: false)
  audit_root = Pathname.new(input)

  library_html =
    library_only || !faces_only ? write_library(audit_root) : nil
  faces =
    faces_only || !library_only ? write_faces(audit_root) : []

  Result.new(input: audit_root.to_s, library_html: library_html&.to_s,
             faces: faces)
rescue StandardError => e
  Result.new(input: input.to_s, error: "#{e.class}: #{e.message}")
end