Sha256: ad8eee4bcfbb09cee4da110acd0812feb4e0a7faa627f9a97f7b9508da577f5f
Contents?: true
Size: 1.64 KB
Versions: 2
Compression:
Stored size: 1.64 KB
Contents
module Munge module Formatters class Dots def initialize @counts = { new: 0, changed: 0, identical: 0 } @relpaths = { new: [], changed: [], identical: [] } @dots = { new: Rainbow("W").green, changed: Rainbow("W").yellow, identical: "." } @total = 0 end def call(_item, relpath, write_status, should_print) @total += 1 @counts[write_status] += 1 if should_print @relpaths[write_status].push(relpath) end print @dots[write_status] end def start @start_time = Time.now puts "Building:" end def done @done_time = Time.now # Print a newline after the line of dots puts list! summary! end private def list! lists = [ [@relpaths[:new], "New items:"], [@relpaths[:changed], "Updated items:"], [@relpaths[:identical], "Identical items:"] ] lists.each do |list, title| if list.empty? next end puts puts title puts puts list.join(", ") end end def summary! write_summary = [ "Created #{@counts[:new]}", "Updated #{@counts[:changed]}", "Ignored #{@counts[:identical]}" ] puts puts "Processed #{@total} in #{@done_time - @start_time} seconds" puts puts write_summary.join(", ") end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
munge-0.11.1 | lib/munge/formatters/dots.rb |
munge-0.11.0 | lib/munge/formatters/dots.rb |