Module: Smith::Doctor::Checks::Rails

Defined in:
lib/smith/doctor/checks/rails.rb

Class Method Summary collapse

Class Method Details

.check_application(report) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/smith/doctor/checks/rails.rb', line 17

def self.check_application(report)
  present = defined?(::Rails.application) && !::Rails.application.nil?
  report.add(
    name: "rails.application",
    status: present ? :pass : :fail,
    message: present ? "Rails application present" : "Rails application not found",
    detail: present ? nil : "Rails is loaded but no application is defined"
  )
end

.check_smith_config(report) ⇒ Object



27
28
29
30
31
32
33
34
35
# File 'lib/smith/doctor/checks/rails.rb', line 27

def self.check_smith_config(report)
  accessible = ::Smith.respond_to?(:config) && !::Smith.config.nil?
  report.add(
    name: "rails.smith_config",
    status: accessible ? :pass : :warn,
    message: accessible ? "Smith config accessible from Rails" : "Smith config not accessible",
    detail: accessible ? nil : "Ensure config/initializers/smith.rb exists"
  )
end

.run(report) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/smith/doctor/checks/rails.rb', line 7

def self.run(report)
  unless defined?(::Rails)
    report.add(name: "rails.detected", status: :skip, message: "Rails not detected")
    return
  end

  check_application(report)
  check_smith_config(report)
end