Class: Kamal::Lint::Formatters::Human
- Inherits:
-
Object
- Object
- Kamal::Lint::Formatters::Human
- Defined in:
- lib/kamal/lint/formatters/human.rb
Constant Summary collapse
- COLORS =
{ reset: "\e[0m", bold: "\e[1m", dim: "\e[2m", red: "\e[31m", yellow: "\e[33m", green: "\e[32m", blue: "\e[34m", magenta: "\e[35m", cyan: "\e[36m", gray: "\e[90m" }.freeze
- SEVERITY_GLYPH =
{ error: "✖", warning: "⚠", info: "•" }.freeze
- SEVERITY_COLOR =
{ error: :red, warning: :yellow, info: :blue }.freeze
Instance Method Summary collapse
-
#initialize(io: $stdout, color: nil) ⇒ Human
constructor
A new instance of Human.
- #render(result) ⇒ Object
Constructor Details
#initialize(io: $stdout, color: nil) ⇒ Human
Returns a new instance of Human.
23 24 25 26 |
# File 'lib/kamal/lint/formatters/human.rb', line 23 def initialize(io: $stdout, color: nil) @io = io @color = color.nil? ? io.tty? : color end |
Instance Method Details
#render(result) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/kamal/lint/formatters/human.rb', line 28 def render(result) render_header(result) groups = result.by_destination if groups.values.all?(&:empty?) @io.puts c(:green, " ✓ No issues found.") return end groups.each do |destination, findings| render_group(destination, findings) end render_summary(result) end |