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.
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.
40 41 42 43 44 45 |
# File 'lib/dependabot/dependency_graphers/base.rb', line 40 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 |
Instance Method Details
#prepare! ⇒ Object
58 59 60 61 |
# File 'lib/dependabot/dependency_graphers/base.rb', line 58 def prepare! @dependencies = @file_parser.parse @prepared = true end |
#relevant_dependency_file ⇒ Object
53 |
# File 'lib/dependabot/dependency_graphers/base.rb', line 53 def relevant_dependency_file; end |
#resolved_dependencies ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/dependabot/dependency_graphers/base.rb', line 64 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 |