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("\n%<info>s\n%<cmd>s\n\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
# 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.\n")
end

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



36
37
38
39
# File 'lib/package/audit/util/summary_printer.rb', line 36

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(technology, report, pkgs, ignored_pkgs) ⇒ Object



25
26
27
28
29
30
31
32
33
34
# File 'lib/package/audit/util/summary_printer.rb', line 25

def self.total(technology, report, pkgs, ignored_pkgs)
  if ignored_pkgs.any?
    puts Util::BashColor.cyan("Found a total of #{pkgs.length} #{technology} packages " \
                              "(#{ignored_pkgs.length} ignored).\n")
  elsif pkgs.any?
    puts Util::BashColor.cyan("Found a total of #{pkgs.length} #{technology} packages.\n")
  else
    puts Util::BashColor.green("There are no #{report} #{technology} packages!\n")
  end
end

.vulnerable(technology, cmd) ⇒ Object



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

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