Class: Ace::Support::Config::Organisms::SetupDoctor::ProviderProgress

Inherits:
Object
  • Object
show all
Defined in:
lib/ace/support/config/organisms/setup_doctor.rb

Instance Method Summary collapse

Constructor Details

#initialize(doctor, io, targets) ⇒ ProviderProgress

Returns a new instance of ProviderProgress.



1070
1071
1072
1073
1074
1075
1076
1077
# File 'lib/ace/support/config/organisms/setup_doctor.rb', line 1070

def initialize(doctor, io, targets)
  @doctor = doctor
  @io = io
  @targets = targets
  @tty = io.respond_to?(:tty?) && io.tty?
  @line_count = 0
  @mutex = Mutex.new
end

Instance Method Details

#finish(index, outcome) ⇒ Object



1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
# File 'lib/ace/support/config/organisms/setup_doctor.rb', line 1088

def finish(index, outcome)
  @mutex.synchronize do
    if @tty
      rewrite_line(index, outcome)
    else
      @io.puts "  #{format_line(outcome, status: outcome[:status], elapsed_ms: outcome[:elapsed_ms])}"
    end
    flush
  end
end

#startObject



1079
1080
1081
1082
1083
1084
1085
1086
# File 'lib/ace/support/config/organisms/setup_doctor.rb', line 1079

def start
  @io.puts "RUN Utility provider pings running (0/#{@targets.length} passed)"
  @targets.each do |target|
    @io.puts "  #{format_line(target, status: "running")}"
  end
  @line_count = @targets.length
  flush
end