Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/bundler/audit/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ class CLI < ::Thor
method_option :ignore, :type => :array, :aliases => '-i'

def check
scanner = Scanner.new
root = File.expand_path(Dir.pwd)
scanner = Scanner.new(File.read(File.join(root, 'Gemfile.lock')))
vulnerable = false

scanner.scan(:ignore => options.ignore) do |result|
Expand Down
12 changes: 3 additions & 9 deletions lib/bundler/audit/scanner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ class Scanner
# @return [Database]
attr_reader :database

# Project root directory
attr_reader :root

# The parsed `Gemfile.lock` from the project
#
# @return [Bundler::LockfileParser]
Expand All @@ -33,15 +30,12 @@ class Scanner
#
# Initializes a scanner.
#
# @param [String] root
# @param [String] lockfile_content
# The path to the project root.
#
def initialize(root=Dir.pwd)
@root = File.expand_path(root)
def initialize(lockfile_content)
@database = Database.new
@lockfile = LockfileParser.new(
File.read(File.join(@root,'Gemfile.lock'))
)
@lockfile = LockfileParser.new(lockfile_content)
end

#
Expand Down