Class: Wip::Doctor

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

Overview

Runs environment diagnostics and reports pass/warn/fail results.

Defined Under Namespace

Classes: Result

Instance Method Summary collapse

Constructor Details

#initialize(loader:, resolver: CommandResolver.new, environment: Environment.new) ⇒ Doctor

Returns a new instance of Doctor.



10
11
12
13
14
# File 'lib/wip/doctor.rb', line 10

def initialize(loader:, resolver: CommandResolver.new, environment: Environment.new)
  @loader = loader
  @resolver = resolver
  @environment = environment
end

Instance Method Details

#callObject



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/wip/doctor.rb', line 16

def call
  results = []
  results << result(@environment.wsl2? ? :ok : :fail, *wsl2_messages)
  results << interop_result unless @environment.windows?
  results << Result.new(:ok, "Architecture: #{@environment.architecture}")
  config = load_config(results)
  command = resolve(config, results) if config
  check_version(command, results) if command
  results << result(command_available?('git') ? :ok : :warn, 'Git is available',
                    'Git is not available to the WSLC build environment')
  results
end