Class: Senren::Rails::Doctor
- Inherits:
-
Object
- Object
- Senren::Rails::Doctor
- Defined in:
- lib/senren/rails/doctor.rb
Overview
Runs a series of checks against the host Rails app and prints a human-readable status report.
Defined Under Namespace
Classes: Result
Instance Attribute Summary collapse
-
#paths ⇒ Object
readonly
Returns the value of attribute paths.
-
#stdout ⇒ Object
readonly
Returns the value of attribute stdout.
Instance Method Summary collapse
-
#initialize(paths: HostPaths.new, stdout: $stdout) ⇒ Doctor
constructor
A new instance of Doctor.
- #run! ⇒ Object
Constructor Details
Instance Attribute Details
#paths ⇒ Object (readonly)
Returns the value of attribute paths.
12 13 14 |
# File 'lib/senren/rails/doctor.rb', line 12 def paths @paths end |
#stdout ⇒ Object (readonly)
Returns the value of attribute stdout.
12 13 14 |
# File 'lib/senren/rails/doctor.rb', line 12 def stdout @stdout end |
Instance Method Details
#run! ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/senren/rails/doctor.rb', line 19 def run! results = [] results << check('ViewComponent gem available') { defined?(::ViewComponent) } results << check('TailwindCSS stylesheet present') { paths.stylesheet_path.exist? } results << check('Stimulus directory present') { paths.stimulus_dir.directory? } results << check('Turbo gem available') { defined?(::Turbo) || gem_loadable?('turbo-rails') } results << check('.senren directory exists') { paths.senren_dir.directory? } results << check('.senren/skill.md exists') { paths.skill_file.file? } results << check('.senren/registry.yml exists') { paths.registry_mirror.file? } results << check('.senren/installed_components.yml exists') { paths.installed_components.file? } results << check('public/llms.txt exists') { paths.llms_short.file? } results << check('public/llms-full.txt exists') { paths.llms_full.file? } results << check('app/components/senren exists') { paths.components_dir.directory? } results << check('app/javascript/controllers/senren exists') { paths.stimulus_dir.directory? } installed = installed_count results << Result.new("#{installed} component(s) installed", installed >= 0, nil) report(results) results.all?(&:ok) end |