Class: Mxrb::Doctor

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

Overview

Diagnoses project structure and optional external toolchain availability.

Instance Method Summary collapse

Constructor Details

#initialize(root = Dir.pwd, runner: Open3.method(:capture3)) ⇒ Doctor

Returns a new instance of Doctor.



17
18
19
20
21
# File 'lib/mxrb/doctor.rb', line 17

def initialize(root = Dir.pwd, runner: Open3.method(:capture3))
  expanded = File.expand_path(root)
  @root = File.file?(expanded) ? File.dirname(expanded) : expanded
  @runner = runner
end

Instance Method Details

#runObject



23
24
25
26
27
28
29
# File 'lib/mxrb/doctor.rb', line 23

def run
  DoctorReport.new(@root, [
    ruby_check, project_check, modules_check, aggregators_check,
    mpr_check, executable_check('bundle'), executable_check('java'),
    executable_check('docker', warning: true), runtime_check
  ].freeze)
end