Module: Package::Audit::Util::SummaryPrinter

Defined in:
lib/package/audit/util/summary_printer.rb

Class Method Summary collapse

Class Method Details

.allObject



8
9
10
11
12
# File 'lib/package/audit/util/summary_printer.rb', line 8

def self.all
  printf(" %<info>s\n %<cmd>s\n",
         info: Util::BashColor.blue('To show how risk is calculated run:'),
         cmd: Util::BashColor.magenta(' > package-audit risk'))
end

.deprecatedObject



14
15
16
17
18
# File 'lib/package/audit/util/summary_printer.rb', line 14

def self.deprecated
  puts " #{Util::BashColor.blue('Although the packages above have no recent updates, ' \
                                'they may not be deprecated.')}"
  puts " #{Util::BashColor.blue('Please contact the package author for more information about its status.')}"
end

.statistics(format, technology, report, pkgs, ignored_pkgs) ⇒ Object



44
45
46
47
# File 'lib/package/audit/util/summary_printer.rb', line 44

def self.statistics(format, technology, report, pkgs, ignored_pkgs)
  stats = calculate_statistics(pkgs, ignored_pkgs)
  display_results(format, technology, report, pkgs, ignored_pkgs, stats)
end

.total(format, technology, report, pkgs, ignored_pkgs) ⇒ Object

rubocop:disable Metrics/MethodLength



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/package/audit/util/summary_printer.rb', line 26

def self.total(format, technology, report, pkgs, ignored_pkgs) # rubocop:disable Metrics/MethodLength
  prefix = format.nil? ? ' ' : ''
  if ignored_pkgs.any?
    puts "#{prefix}#{Util::BashColor.cyan(
      "Found a total of #{pkgs.length} #{technology.capitalize} packages " \
      "(#{ignored_pkgs.length} ignored)."
    )}"
  elsif pkgs.any?
    puts "#{prefix}#{Util::BashColor.cyan(
      "Found a total of #{pkgs.length} #{technology.capitalize} packages."
    )}"
  else
    puts "#{prefix}#{Util::BashColor.green(
      "There are no #{report} #{technology.capitalize} packages!"
    )}"
  end
end

.vulnerable(technology, cmd) ⇒ Object



20
21
22
23
24
# File 'lib/package/audit/util/summary_printer.rb', line 20

def self.vulnerable(technology, cmd)
  printf(" %<info>s\n %<cmd>s\n",
         info: Util::BashColor.blue("For more information about #{technology.capitalize} vulnerabilities run:"),
         cmd: Util::BashColor.magenta(" > #{cmd}"))
end