Class: EasyCaddy::Commands::Doctor

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

Instance Method Summary collapse

Instance Method Details

#callObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/easy_caddy/commands/doctor.rb', line 9

def call
  registry = Registry.load
  findings = Conflicts.doctor(registry: registry)

  if findings.empty?
    puts '  All clear — no conflicts or dead upstreams detected.'
    return
  end

  has_block = false
  findings.each do |f|
    label = case f.severity
            when 'BLOCK' then "\e[31mBLOCK\e[0m"
            when 'WARN'  then "\e[33mWARN \e[0m"
            else              "\e[34mINFO \e[0m"
            end
    puts "  #{label}  #{f.message}"
    puts "#{f.hint}"
    has_block = true if f.severity == 'BLOCK'
  end

  exit 1 if has_block
end