class Lapidarist::Summary
Attributes
gems[R]
Public Class Methods
new(gems)
click to toggle source
# File lib/lapidarist/summary.rb, line 3 def initialize(gems) @gems = gems end
Public Instance Methods
display()
click to toggle source
# File lib/lapidarist/summary.rb, line 7 def display Lapidarist.logger.summary '' Lapidarist.logger.summary 'Summary' Lapidarist.logger.summary '-'*50 Lapidarist.logger.summary "#{object_count(gems.updated, 'gem', 'gems')} updated, #{object_count(gems.failed, 'gem', 'gems')} failed and #{object_count(gems.skipped, 'gem', 'gems')} skipped in #{object_count(gems.attempts, 'attempt', 'attempts')}" summarize_attempts do |summary| Lapidarist.logger.summary summary end end
display_debug()
click to toggle source
# File lib/lapidarist/summary.rb, line 17 def display_debug Lapidarist.logger.debug "#{object_count(gems.updated, 'gem', 'gems')} updated, #{object_count(gems.failed, 'gem', 'gems')} failed and #{object_count(gems.skipped, 'gem', 'gems')} skipped in #{object_count(gems.attempts, 'attempt', 'attempts')}" summarize_attempts do |summary| Lapidarist.logger.debug summary end end
Private Instance Methods
object_count(objects_or_length, singlular, plural)
click to toggle source
# File lib/lapidarist/summary.rb, line 28 def object_count(objects_or_length, singlular, plural) length = if objects_or_length.respond_to?(:length) objects_or_length.length else objects_or_length end if length == 1 "1 #{singlular}" else "#{length} #{plural}" end end
summarize_attempts() { |summary| ... }
click to toggle source
# File lib/lapidarist/summary.rb, line 43 def summarize_attempts gems.each do |gem| gem.attempts.each do |i, data| summary = case data.status when :updated " + updated #{gem.name} from #{gem.installed_version} to #{data.version}" when :failed " x failed #{gem.name} from #{gem.installed_version} to #{data.version}" when :skipped " - skipped #{gem.name} (#{data.reason})" end yield summary end end end