Class: Bundler::Audit::Scanner
- Inherits:
-
Object
- Object
- Bundler::Audit::Scanner
- Defined in:
- lib/bundler/audit/scanner.rb
Defined Under Namespace
Classes: InsecureSource, UnpatchedGem
Instance Attribute Summary collapse
-
#database ⇒ Database
readonly
The advisory database.
-
#lockfile ⇒ Bundler::LockfileParser
readonly
The parsed
Gemfile.lock
from the project. -
#root ⇒ Object
readonly
Project root directory.
Instance Method Summary collapse
-
#initialize(root = Dir.pwd) ⇒ Scanner
constructor
Initializes a scanner.
-
#scan(options = {}) {|result| ... } ⇒ Enumerator
Scans the project for issues.
Constructor Details
Instance Attribute Details
#database ⇒ Database (readonly)
The advisory database
20 21 22 |
# File 'lib/bundler/audit/scanner.rb', line 20 def database @database end |
#lockfile ⇒ Bundler::LockfileParser (readonly)
The parsed Gemfile.lock
from the project
28 29 30 |
# File 'lib/bundler/audit/scanner.rb', line 28 def lockfile @lockfile end |
#root ⇒ Object (readonly)
Project root directory
23 24 25 |
# File 'lib/bundler/audit/scanner.rb', line 23 def root @root end |
Instance Method Details
#scan(options = {}) {|result| ... } ⇒ Enumerator
Scans the project for issues.
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/bundler/audit/scanner.rb', line 62 def scan(={}) return enum_for(__method__,) unless block_given? ignore = Set[] ignore += [:ignore] if [:ignore] @lockfile.sources.map do |source| case source when Source::Git case source.uri when /^git:/, /^http:/ yield InsecureSource.new(source.uri) end when Source::Rubygems source.remotes.each do |uri| if uri.scheme == 'http' yield InsecureSource.new(uri.to_s) end end end end @lockfile.specs.each do |gem| @database.check_gem(gem) do |advisory| unless ignore.include?(advisory.id) yield UnpatchedGem.new(gem,advisory) end end end return self end |