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.



17
18
19
20
21
22
23
24
25
26
# File 'lib/package/audit/services/command_parser.rb', line 17

def initialize(dir, options, report)
  @dir = dir
  @options = options
  @report = report
  @config = parse_config_file!
  @groups = @options[Enum::Option::GROUP]
  @technologies = parse_technologies!
  validate_format!
  @spinner = Util::Spinner.new('Evaluating packages and their dependencies...')
end

Instance Method Details

#runObject



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/package/audit/services/command_parser.rb', line 28

def run
  if File.file? @dir.to_s
    raise "\"#{@dir}\" is a file instead of directory"
  elsif !File.directory? @dir.to_s
    raise "\"#{@dir}\" is not a valid directory"
  elsif @technologies.empty?
    raise 'No supported technologies found in this directory'
  else
    process_technologies
  end
end