Class: Ace::Support::Config::Molecules::SetupDoctorReporter

Inherits:
Object
  • Object
show all
Defined in:
lib/ace/support/config/molecules/setup_doctor_reporter.rb

Constant Summary collapse

COLORS =
{
  red: "\e[31m",
  yellow: "\e[33m",
  green: "\e[32m",
  blue: "\e[34m",
  cyan: "\e[36m",
  reset: "\e[0m",
  bold: "\e[1m"
}.freeze
ICONS =
{
  doctor: "đŸĨ",
  stats: "📊",
  success: "✅",
  error: "❌",
  warning: "âš ī¸",
  info: "â„šī¸"
}.freeze
STATUS_GLYPHS =
{
  "pass" => "✓",
  "warn" => "○",
  "blocker" => "✗",
  "skip" => "○",
  "info" => "○"
}.freeze
STATUS_COLORS =
{
  "pass" => :green,
  "warn" => :yellow,
  "blocker" => :red,
  "skip" => :yellow,
  "info" => :cyan
}.freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(results, hygiene:, verbose:, colors:) ⇒ SetupDoctorReporter

Returns a new instance of SetupDoctorReporter.



54
55
56
57
58
59
# File 'lib/ace/support/config/molecules/setup_doctor_reporter.rb', line 54

def initialize(results, hygiene:, verbose:, colors:)
  @results = results
  @hygiene = hygiene
  @verbose = verbose
  @colors = colors
end

Class Method Details

.format_results(results, format: :terminal, hygiene: false, verbose: false, colors: true) ⇒ Object



45
46
47
48
49
50
51
52
# File 'lib/ace/support/config/molecules/setup_doctor_reporter.rb', line 45

def self.format_results(results, format: :terminal, hygiene: false, verbose: false, colors: true)
  case format.to_sym
  when :json
    JSON.pretty_generate(results)
  else
    new(results, hygiene: hygiene, verbose: verbose, colors: colors).format_terminal
  end
end

Instance Method Details

#format_terminalObject



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/ace/support/config/molecules/setup_doctor_reporter.rb', line 61

def format_terminal
  output = []
  output << "\n#{colorize("#{ICONS[:doctor]} Setup Health Check", :bold)}"
  output << "=" * 40
  output.concat(format_overview)
  output.concat(format_readiness)
  output.concat(format_info)
  output.concat(format_provider_pings)
  output.concat(format_issues)
  output << "=" * 40
  output << format_summary_line
  output << "\n#{colorize("Completed in #{format_duration(@results[:duration])}", :blue)}" if @results[:duration]
  output << final_status_line
  output.join("\n")
end