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, compose_resolver: CommandResolver.new(candidates: [], label: 'compose command', install_hint: ComposeBridge::INSTALL_HINT)) ⇒ Doctor

Returns a new instance of Doctor.



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

def initialize(loader:, resolver: CommandResolver.new, environment: Environment.new,
               compose_resolver: CommandResolver.new(candidates: [], label: 'compose command',
                                                     install_hint: ComposeBridge::INSTALL_HINT))
  @loader = loader
  @resolver = resolver
  @environment = environment
  @compose_resolver = compose_resolver
end

Instance Method Details

#callObject



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

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