Class: WAMR::Scanner

Inherits:
Object
  • Object
show all
Defined in:
lib/wamr/scanner.rb

Instance Method Summary collapse

Constructor Details

#initialize(root_path = ".") ⇒ Scanner

Returns a new instance of Scanner.



6
7
8
# File 'lib/wamr/scanner.rb', line 6

def initialize(root_path = ".")
  @root_path = File.expand_path(root_path)
end

Instance Method Details

#scanObject



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/wamr/scanner.rb', line 10

def scan
  command = build_command

  stdout, stderr, status = Open3.capture3(command)

  if status.success?
    paths = stdout.split("\n").map { |p| p.sub(/\/\.git$/, '').strip }.reject(&:empty?)
    display_results(paths)
  else
    puts "Error running command: #{stderr}"
  end
end