Class: GDK::Command::Doctor

Inherits:
BaseCommand show all
Defined in:
lib/gdk/command/doctor.rb

Instance Attribute Summary

Attributes inherited from BaseCommand

#stderr, #stdout

Instance Method Summary collapse

Methods inherited from BaseCommand

#config, #display_help_message, #help, #print_help, #print_ready_message, #ready_messages, validate_config?

Constructor Details

#initialize(diagnostics: GDK::Diagnostic.all, **args) ⇒ Doctor

Returns a new instance of Doctor.



6
7
8
9
10
11
# File 'lib/gdk/command/doctor.rb', line 6

def initialize(diagnostics: GDK::Diagnostic.all, **args)
  @diagnostics = diagnostics
  @unexpected_error = false

  super(**args)
end

Instance Method Details

#run(_ = []) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/gdk/command/doctor.rb', line 13

def run(_ = [])
  unless installed?
    GDK::Output.warn("GDK has not been installed so cannot run 'gdk doctor'. Try running `gem install gitlab-development-kit` again.")
    return false
  end

  start_necessary_services

  if diagnostic_results.empty?
    show_healthy

    true
  else
    show_results

    return 2 if @unexpected_error

    false
  end
end