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.



783
784
785
786
787
788
789
790
# File 'lib/ace/support/config/organisms/setup_doctor.rb', line 783

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



801
802
803
804
805
806
807
808
809
810
# File 'lib/ace/support/config/organisms/setup_doctor.rb', line 801

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



792
793
794
795
796
797
798
799
# File 'lib/ace/support/config/organisms/setup_doctor.rb', line 792

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