Class: Dash::Cli::Doctor

Inherits:
Object
  • Object
show all
Includes:
SSHKit::DSL
Defined in:
lib/dash/cli/doctor.rb

Overview

Runs read-only deploy readiness checks and collects the results, without ever raising on a broken environment - failures become failing results instead.

Defined Under Namespace

Classes: ConfigChecks, EndpointChecks, HostChecks, Result

Constant Summary collapse

HOST_CHECKS =
%i[ ssh docker registry proxy_image proxy_version proxy_socket ports ]
CHECK_TITLES =
{
  ssh: "SSH",
  docker: "Docker",
  registry: "Registry",
  proxy_image: "Proxy image",
  proxy_version: "Proxy version",
  proxy_socket: "Proxy docker socket",
  ports: "Ports",
  dns: "DNS",
  certificate: "Certificates",
  readiness: "Readiness",
  dockerfile: "Dockerfile"
}.freeze
STATUS_COLORS =
{ ok: :green, warn: :yellow, fail: :red }.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize ⇒ Doctor

Returns a new instance of Doctor.



50
51
52
# File 'lib/dash/cli/doctor.rb', line 50

def initialize
  @results = []
end

Instance Attribute Details

#results ⇒ Object (readonly)

Returns the value of attribute results.



48
49
50
# File 'lib/dash/cli/doctor.rb', line 48

def results
  @results
end

Instance Method Details

#failures ⇒ Object



58
59
60
# File 'lib/dash/cli/doctor.rb', line 58

def failures
  results.select(&:fail?)
end

#run ⇒ Object



54
55
56
# File 'lib/dash/cli/doctor.rb', line 54

def run
  @results = host_check_results + endpoint_check_results + config_check_results
end

#successful? ⇒ Boolean

Returns:

  • (Boolean)


66
67
68
# File 'lib/dash/cli/doctor.rb', line 66

def successful?
  failures.none?
end

#warnings ⇒ Object



62
63
64
# File 'lib/dash/cli/doctor.rb', line 62

def warnings
  results.select(&:warn?)
end