Module: Insta::PendingReporter

Defined in:
lib/insta/pending_reporter.rb,
sig/insta/pending_reporter.rbs

Class Method Summary collapse

Class Method Details

.flush_and_report!void

This method returns an undefined value.

: () -> void



6
7
8
9
10
11
12
13
14
# File 'lib/insta/pending_reporter.rb', line 6

def self.flush_and_report!
  Inline::PendingRegistry.flush!
  Inline::PendingStore.flush!
  PendingLocations.flush!
  ConfigManifest.write!

  report_pending_files!
  report_pending_inline!
end

.report_pending_files!void

This method returns an undefined value.

: () -> void



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/insta/pending_reporter.rb', line 17

def self.report_pending_files!
  snapshot_path = Insta.configuration.snapshot_path
  extension = Insta.configuration.snapshot_extension
  pending_files = Dir.glob(File.join(snapshot_path, "**", "*#{extension}.new"))

  return unless pending_files.any?

  count = pending_files.length
  noun = count == 1 ? "snapshot" : "snapshots"
  warn "\n\e[33m●\e[0m #{count} pending file #{noun}:\n\n"
  pending_files.each { |f| warn "  \e[33m›\e[0m #{f}" }
  warn "\n  \e[36mbundle exec insta review\e[0m\n\n"
end

.report_pending_inline!void

This method returns an undefined value.

: () -> void



32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/insta/pending_reporter.rb', line 32

def self.report_pending_inline!
  entries = Inline::PendingStore.load
  return unless entries.any?

  count = entries.length
  noun = count == 1 ? "snapshot" : "snapshots"
  warn "\n\e[33m●\e[0m #{count} pending inline #{noun}:\n\n"

  entries.each do |entry|
    warn "  \e[33m›\e[0m #{entry[:file]}:#{entry[:line]}"
  end

  warn "\n  \e[36mbundle exec insta review\e[0m\n\n"
end