Class: Package::Audit::CommandParser

Inherits:
Object
  • Object
show all
Defined in:
lib/package/audit/services/command_parser.rb

Instance Method Summary collapse

Constructor Details

#initialize(dir, options, report) ⇒ CommandParser

Returns a new instance of CommandParser.



16
17
18
19
20
21
22
# File 'lib/package/audit/services/command_parser.rb', line 16

def initialize(dir, options, report)
  @dir = dir
  @options = options
  @report = report
  @config = parse_config_file
  @technologies = parse_technologies
end

Instance Method Details

#runObject



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/package/audit/services/command_parser.rb', line 24

def run
  cumulative_pkgs = []

  @technologies.each do |technology|
    all_pkgs, ignored_pkgs = PackageFinder.new(@config, @dir, @report).run(technology)
    ignored_pkgs = [] if @options[Enum::Option::INCLUDE_IGNORED]
    cumulative_pkgs << all_pkgs
    print_results(technology, (all_pkgs || []) - (ignored_pkgs || []), ignored_pkgs || [])
  end

  cumulative_pkgs.any?
end