Class: Lilac::CLI::Doctor
- Inherits:
-
Object
- Object
- Lilac::CLI::Doctor
- Defined in:
- lib/lilac/cli/doctor.rb
Overview
Inspect a Lilac project for the common ways a fresh lilac new
fails before the user sees the page boot. Catches missing wasm
runtime, dangling <lilac-component> references, unparseable
.lil, and similar setup problems.
run returns 0 when every check passes (or only warns); 1 when
any check produced an :error result. Output is plain-text and
mirrors the layout of rails about / bundle doctor /
npx ... doctor — one line per check, prefix marks the level.
Defined Under Namespace
Classes: Result
Constant Summary collapse
- RUNTIME_WASM =
Where the wasm runtime is expected to live, relative to public_dir. Both live under
vendor/lilac-full/so the target-aware public mirror can prune them when building--target compiled. Sourced from the singleVendorWriter::REQUIRED_ASSETSdefinition. VendorWriter::REQUIRED_ASSETS[:full][:wasm]
- RUNTIME_JS_ADAPTER =
VendorWriter::REQUIRED_ASSETS[:full][:bridge]
Instance Method Summary collapse
-
#initialize(config, out: $stdout) ⇒ Doctor
constructor
A new instance of Doctor.
-
#run ⇒ Object
Returns exit status (0 if no errors).
Constructor Details
#initialize(config, out: $stdout) ⇒ Doctor
Returns a new instance of Doctor.
32 33 34 35 |
# File 'lib/lilac/cli/doctor.rb', line 32 def initialize(config, out: $stdout) @config = config @out = out end |
Instance Method Details
#run ⇒ Object
Returns exit status (0 if no errors).
38 39 40 41 42 |
# File 'lib/lilac/cli/doctor.rb', line 38 def run results = run_checks emit(results) results.any? { |r| r.level == :error } ? 1 : 0 end |