Class: Package::Audit::Npm::NodeCollection
- Inherits:
-
Object
- Object
- Package::Audit::Npm::NodeCollection
- Defined in:
- lib/package/audit/npm/node_collection.rb
Instance Method Summary collapse
- #all ⇒ Object
- #deprecated ⇒ Object
- #fetch ⇒ Object
-
#initialize(dir, report) ⇒ NodeCollection
constructor
A new instance of NodeCollection.
- #outdated ⇒ Object
- #vulnerable ⇒ Object
Constructor Details
#initialize(dir, report) ⇒ NodeCollection
Returns a new instance of NodeCollection.
11 12 13 14 |
# File 'lib/package/audit/npm/node_collection.rb', line 11 def initialize(dir, report) @dir = dir @report = report end |
Instance Method Details
#all ⇒ Object
29 30 31 32 33 34 |
# File 'lib/package/audit/npm/node_collection.rb', line 29 def all implicit_pkgs = fetch_from_lock_file vulnerable_pkgs = VulnerabilityFinder.new(@dir, implicit_pkgs).run pkgs = NpmMetaData.new(vulnerable_pkgs + implicit_pkgs).fetch.filter(&:risk?) DuplicatePackageMerger.new(pkgs).run end |
#deprecated ⇒ Object
36 37 38 39 40 |
# File 'lib/package/audit/npm/node_collection.rb', line 36 def deprecated implicit_pkgs = fetch_from_lock_file pkgs = NpmMetaData.new(implicit_pkgs).fetch.filter(&:deprecated?) DuplicatePackageMerger.new(pkgs).run end |
#fetch ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/package/audit/npm/node_collection.rb', line 16 def fetch case @report when Enum::Report::DEPRECATED deprecated when Enum::Report::OUTDATED outdated when Enum::Report::VULNERABLE vulnerable else all end end |
#outdated ⇒ Object
42 43 44 45 46 |
# File 'lib/package/audit/npm/node_collection.rb', line 42 def outdated implicit_pkgs = fetch_from_lock_file pkgs = NpmMetaData.new(implicit_pkgs).fetch.filter(&:outdated?) DuplicatePackageMerger.new(pkgs).run end |
#vulnerable ⇒ Object
48 49 50 51 52 53 |
# File 'lib/package/audit/npm/node_collection.rb', line 48 def vulnerable implicit_pkgs = fetch_from_lock_file vulnerable_pkgs = VulnerabilityFinder.new(@dir, implicit_pkgs).run pkgs = NpmMetaData.new(vulnerable_pkgs).fetch DuplicatePackageMerger.new(pkgs).run end |