Module: Smith::Doctor::Checks::Baseline
- Defined in:
- lib/smith/doctor/checks/baseline.rb
Class Method Summary collapse
- .check_concurrent_loads(report) ⇒ Object
- .check_configure(report) ⇒ Object
- .check_minimal_workflow(report) ⇒ Object
- .check_ruby_llm_loads(report) ⇒ Object
- .check_ruby_version(report) ⇒ Object
- .check_smith_loads(report) ⇒ Object
- .run(report) ⇒ Object
Class Method Details
.check_concurrent_loads(report) ⇒ Object
45 46 47 48 49 50 51 52 53 |
# File 'lib/smith/doctor/checks/baseline.rb', line 45 def self.check_concurrent_loads(report) loaded = defined?(::Concurrent) report.add( name: "baseline.concurrent_loads", status: loaded ? :pass : :fail, message: loaded ? "concurrent-ruby loads" : "concurrent-ruby failed to load", detail: loaded ? nil : "Ensure concurrent-ruby is in your Gemfile" ) end |
.check_configure(report) ⇒ Object
55 56 57 58 59 60 61 62 |
# File 'lib/smith/doctor/checks/baseline.rb', line 55 def self.check_configure(report) callable = ::Smith.respond_to?(:configure) && ::Smith.respond_to?(:config) report.add( name: "baseline.configure", status: callable ? :pass : :fail, message: callable ? "Smith.configure callable" : "Smith.configure not available" ) end |
.check_minimal_workflow(report) ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/smith/doctor/checks/baseline.rb', line 64 def self.check_minimal_workflow(report) workflow_class = Class.new(::Smith::Workflow) do initial_state :idle state :done transition :check, from: :idle, to: :done end booted = workflow_class.new.state == :idle report.add( name: "baseline.minimal_workflow", status: booted ? :pass : :fail, message: booted ? "Minimal workflow boots" : "Minimal workflow failed to initialize" ) rescue StandardError => e report.add(name: "baseline.minimal_workflow", status: :fail, message: "Minimal workflow failed", detail: e.) end |
.check_ruby_llm_loads(report) ⇒ Object
35 36 37 38 39 40 41 42 43 |
# File 'lib/smith/doctor/checks/baseline.rb', line 35 def self.check_ruby_llm_loads(report) loaded = defined?(::RubyLLM) report.add( name: "baseline.ruby_llm_loads", status: loaded ? :pass : :fail, message: loaded ? "ruby_llm loads" : "ruby_llm failed to load", detail: loaded ? nil : "Ensure ruby_llm is in your Gemfile" ) end |
.check_ruby_version(report) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/smith/doctor/checks/baseline.rb', line 25 def self.check_ruby_version(report) satisfied = Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.2.0") report.add( name: "baseline.ruby_version", status: satisfied ? :pass : :fail, message: satisfied ? "Ruby #{RUBY_VERSION}" : "Ruby #{RUBY_VERSION} is below minimum 3.2.0", detail: satisfied ? nil : "Smith requires Ruby >= 3.2.0" ) end |
.check_smith_loads(report) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/smith/doctor/checks/baseline.rb', line 16 def self.check_smith_loads(report) report.add( name: "baseline.smith_loads", status: defined?(::Smith) ? :pass : :fail, message: defined?(::Smith) ? "smith loads" : "smith failed to load", detail: defined?(::Smith) ? nil : "Ensure smith is in your Gemfile and bundle install has been run" ) end |
.run(report) ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/smith/doctor/checks/baseline.rb', line 7 def self.run(report) check_smith_loads(report) check_ruby_version(report) check_ruby_llm_loads(report) check_concurrent_loads(report) check_configure(report) check_minimal_workflow(report) end |