Class: Wip::Doctor
- Inherits:
-
Object
- Object
- Wip::Doctor
- 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
- #call ⇒ Object
-
#initialize(loader:, resolver: CommandResolver.new, environment: Environment.new) ⇒ Doctor
constructor
A new instance of Doctor.
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
#call ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/wip/doctor.rb', line 16 def call results = [] results << result(@environment.wsl2? ? :ok : :fail, 'Running on WSL2', 'Not running on WSL2') results << result(@environment.windows_interop? ? :ok : :fail, 'Windows executable interoperability is enabled', 'Windows executable interoperability is disabled') 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 |