Class: Senren::Rails::Doctor

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initialize(paths: HostPaths.new, stdout: $stdout) ⇒ Doctor

Returns a new instance of Doctor.



14
15
16
17
# File 'lib/senren/rails/doctor.rb', line 14

def initialize(paths: HostPaths.new, stdout: $stdout)
  @paths  = paths
  @stdout = stdout
end

Instance Attribute Details

#pathsObject (readonly)

Returns the value of attribute paths.



12
13
14
# File 'lib/senren/rails/doctor.rb', line 12

def paths
  @paths
end

#stdoutObject (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
# File 'lib/senren/rails/doctor.rb', line 19

def run!
  results = runtime_checks + installation_checks
  installed = installed_count
  results << Result.new("#{installed} component(s) installed", installed >= 0, nil)

  report(results)
  results.all?(&:ok)
end