Class: Dependabot::DependencyGraphers::Base
- Inherits:
-
Object
- Object
- Dependabot::DependencyGraphers::Base
- Extended by:
- T::Helpers, T::Sig
- Defined in:
- lib/dependabot/dependency_graphers/base.rb
Direct Known Subclasses
Constant Summary collapse
- PURL_TEMPLATE =
"pkg:%<type>s/%<name>s%<version>s"
Instance Attribute Summary collapse
-
#errored_fetching_subdependencies ⇒ Object
readonly
Returns the value of attribute errored_fetching_subdependencies.
-
#prepared ⇒ Object
readonly
Returns the value of attribute prepared.
-
#subdependency_error ⇒ Object
readonly
Returns the value of attribute subdependency_error.
Instance Method Summary collapse
-
#initialize(file_parser:) ⇒ Base
constructor
A new instance of Base.
- #prepare! ⇒ Object
- #relevant_dependency_file ⇒ Object
- #resolved_dependencies ⇒ Object
Constructor Details
#initialize(file_parser:) ⇒ Base
Returns a new instance of Base.
43 44 45 46 47 48 |
# File 'lib/dependabot/dependency_graphers/base.rb', line 43 def initialize(file_parser:) @file_parser = file_parser @dependencies = T.let([], T::Array[Dependabot::Dependency]) @prepared = T.let(false, T::Boolean) @errored_fetching_subdependencies = T.let(false, T::Boolean) end |
Instance Attribute Details
#errored_fetching_subdependencies ⇒ Object (readonly)
Returns the value of attribute errored_fetching_subdependencies.
35 36 37 |
# File 'lib/dependabot/dependency_graphers/base.rb', line 35 def errored_fetching_subdependencies @errored_fetching_subdependencies end |
#prepared ⇒ Object (readonly)
Returns the value of attribute prepared.
32 33 34 |
# File 'lib/dependabot/dependency_graphers/base.rb', line 32 def prepared @prepared end |
#subdependency_error ⇒ Object (readonly)
Returns the value of attribute subdependency_error.
38 39 40 |
# File 'lib/dependabot/dependency_graphers/base.rb', line 38 def subdependency_error @subdependency_error end |
Instance Method Details
#prepare! ⇒ Object
61 62 63 64 |
# File 'lib/dependabot/dependency_graphers/base.rb', line 61 def prepare! @dependencies = @file_parser.parse @prepared = true end |
#relevant_dependency_file ⇒ Object
56 |
# File 'lib/dependabot/dependency_graphers/base.rb', line 56 def relevant_dependency_file; end |
#resolved_dependencies ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/dependabot/dependency_graphers/base.rb', line 67 def resolved_dependencies prepare! unless prepared @dependencies.each_with_object({}) do |dep, resolved| purl = build_purl(dep) resolved[purl] = ResolvedDependency.new( package_url: purl, direct: dep.top_level?, runtime: dep.production?, dependencies: safe_fetch_subdependencies(dep).map { |d| build_purl(d) } ) end end |