Class: Ruact::Doctor

Inherits:
Object
  • Object
show all
Defined in:
lib/ruact/doctor.rb

Overview

Runs a suite of installation health checks and prints ✓/✗ per check. Extracted from the ruact:doctor Rake task for direct testability (FR27).

Constant Summary collapse

CHECKS =
%i[manifest vite controller layout streaming legacy_constant].freeze
LEGACY_CONST =

Built via Array#join so the gem-CI ‘name-propagation` guard does not match these literals against itself (Story 5.1 review F4 — the doctor file participates in the guard with no exclusion).

%w[Rails Rsc].join
LEGACY_GEM =
%w[rails rsc].join("_")
LEGACY_CONSTANT_RE =
/(?<![A-Za-z_])(?:#{LEGACY_CONST}|#{LEGACY_GEM})(?![A-Za-z_])/
LEGACY_SCAN_GLOBS =
["config/initializers/**/*.rb", "app/**/*.rb"].freeze
RENAME_DOC_URL =
"https://github.com/luizcg/ruact/blob/main/CHANGELOG.md#renamed"

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.runObject

Runs all checks, prints results, returns true if all pass.



21
22
23
# File 'lib/ruact/doctor.rb', line 21

def self.run
  new.run
end

Instance Method Details

#runObject



25
26
27
28
29
30
31
32
# File 'lib/ruact/doctor.rb', line 25

def run
  puts "[ruact] Health check"
  results = CHECKS.map { |check| send(:"check_#{check}") }
  results.each { |status, message| puts format_result(status, message) }
  passed = results.all? { |status, _| status == :pass }
  puts "Run rails generate ruact:install to fix configuration issues" unless passed
  passed
end