class SleepingKingStudios::Tasks::Apps::Ci::ResultsReporter
Reports on the results of a multi-application continuous integration process, printing the step results grouped by application.
Public Class Methods
new(context)
click to toggle source
# File lib/sleeping_king_studios/tasks/apps/ci/results_reporter.rb, line 21 def initialize context @context = context end
Public Instance Methods
applications()
click to toggle source
# File lib/sleeping_king_studios/tasks/apps/ci/results_reporter.rb, line 25 def applications @context.send(:applications) end
call(results)
click to toggle source
# File lib/sleeping_king_studios/tasks/apps/ci/results_reporter.rb, line 29 def call results width = 1 + heading_width(results) results.each do |application, app_results| report_application application, app_results, :width => width end # each end
Private Instance Methods
generate_rows(results, width: results.map do |key, obj| next nil if obj.nil?)
click to toggle source
# File lib/sleeping_king_studios/tasks/apps/ci/results_reporter.rb, line 45 def generate_rows results, width: results.map do |key, obj| next nil if obj.nil? badge = format(" %-#{width}.#{width}s", "#{key}:") [set_color(badge, results_color(obj)), obj.to_s] end
heading_width(results)
click to toggle source
# File lib/sleeping_king_studios/tasks/apps/ci/results_reporter.rb, line 39 def heading_width results results.reduce(0) do |memo, (_, hsh)| [memo, *hsh.keys.map(&:size)].max end # reduce end