Sha256: 45f8b174514a2875e0219b0d159903462c7b5746723242a54b775460df1dc1ec

Contents?: true

Size: 1.02 KB

Versions: 5

Compression:

Stored size: 1.02 KB

Contents

# typed: true
# frozen_string_literal: true

require 'frontman/builder/builder'
require 'frontman/builder/mapping'
require 'frontman/toolbox/timer'
require 'sorbet-runtime'

module Frontman
  module Builder
    class StatisticsCollector
      extend T::Sig

      sig do
        params(
          builder: Frontman::Builder::Builder,
          mapping: Frontman::Builder::Mapping,
          timer: Frontman::Toolbox::Timer,
          new_files: T::Array[String]
        ).void
      end
      def self.output(builder, mapping, timer, new_files = [])
        puts JSON.pretty_generate(mapping.all)
        puts '================================================================='
        puts "Previous build size : #{builder.current_build_files.size} files"
        puts "Current build size  : #{new_files.size} files"

        %i[updated created deleted unchanged].each do |status|
          puts "#{status}    : #{Array(mapping.all[status]).length} files"
        end

        timer.stop
        puts timer.output
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
frontman-ssg-0.1.1 lib/frontman/builder/statistics_collector.rb
frontman-ssg-0.1.0 lib/frontman/builder/statistics_collector.rb
frontman-ssg-0.0.4 lib/frontman/builder/statistics_collector.rb
frontman-ssg-0.0.3 lib/frontman/builder/statistics_collector.rb
frontman-ssg-0.0.2 lib/frontman/builder/statistics_collector.rb