class Packwerk::Formatters::ProgressFormatter

Public Class Methods

new(out, style: OutputStyles::Plain.new) click to toggle source
# File lib/packwerk/formatters/progress_formatter.rb, line 12
def initialize(out, style: OutputStyles::Plain.new)
  @out = out
  @style = style
end

Public Instance Methods

finished(execution_time) click to toggle source
# File lib/packwerk/formatters/progress_formatter.rb, line 40
def finished(execution_time)
  @out.puts
  @out.puts("📦 Finished in #{execution_time.round(2)} seconds")
end
interrupted() click to toggle source
# File lib/packwerk/formatters/progress_formatter.rb, line 45
def interrupted
  @out.puts
  @out.puts("Manually interrupted. Violations caught so far are listed below:")
end
mark_as_failed() click to toggle source
# File lib/packwerk/formatters/progress_formatter.rb, line 36
def mark_as_failed
  @out.print("#{@style.error}E#{@style.reset}")
end
mark_as_inspected() click to toggle source
# File lib/packwerk/formatters/progress_formatter.rb, line 32
def mark_as_inspected
  @out.print(".")
end
started(target_files) click to toggle source
# File lib/packwerk/formatters/progress_formatter.rb, line 17
def started(target_files)
  files_size = target_files.size
  files_string = Inflector.default.pluralize("file", files_size)
  @out.puts("📦 Packwerk is inspecting #{files_size} #{files_string}")
end
started_validation() { || ... } click to toggle source
# File lib/packwerk/formatters/progress_formatter.rb, line 23
def started_validation
  @out.puts("📦 Packwerk is running validation...")

  execution_time = Benchmark.realtime { yield }
  finished(execution_time)

  @out.puts("✅ Packages are valid. Use `packwerk check` to run static checks.")
end