class GovukSecurityAudit::Scanner

Public Class Methods

new(path = Dir.pwd) click to toggle source
# File lib/govuk_security_audit/scanner.rb, line 7
def initialize(path = Dir.pwd)
  path = File.expand_path(path)

  if File.directory?(path)
    path = File.join(path, "Gemfile.lock")
  end

  @root = File.dirname(path)
  @database = Bundler::Audit::Database.new

  # Stop Bundler trying to find a Gemfile to accompany our Lockfiles
  ENV["BUNDLE_GEMFILE"] = "Dummy"

  @lockfile = Bundler::LockfileParser.new(File.read(path))
end