Class: Dependabot::Nuget::NativeProjectDiscovery
- Inherits:
-
NativeDependencyFileDiscovery
- Object
- NativeDependencyFileDiscovery
- Dependabot::Nuget::NativeProjectDiscovery
- Extended by:
- T::Sig
- Defined in:
- lib/dependabot/nuget/native_discovery/native_project_discovery.rb
Instance Attribute Summary collapse
-
#properties ⇒ Object
readonly
Returns the value of attribute properties.
-
#referenced_project_paths ⇒ Object
readonly
Returns the value of attribute referenced_project_paths.
-
#target_frameworks ⇒ Object
readonly
Returns the value of attribute target_frameworks.
Attributes inherited from NativeDependencyFileDiscovery
Class Method Summary collapse
Instance Method Summary collapse
- #dependency_set ⇒ Object
-
#initialize(file_path:, properties:, target_frameworks:, referenced_project_paths:, dependencies:) ⇒ NativeProjectDiscovery
constructor
A new instance of NativeProjectDiscovery.
Constructor Details
#initialize(file_path:, properties:, target_frameworks:, referenced_project_paths:, dependencies:) ⇒ NativeProjectDiscovery
Returns a new instance of NativeProjectDiscovery.
54 55 56 57 58 59 |
# File 'lib/dependabot/nuget/native_discovery/native_project_discovery.rb', line 54 def initialize(file_path:, properties:, target_frameworks:, referenced_project_paths:, dependencies:) super(file_path: file_path, dependencies: dependencies) @properties = properties @target_frameworks = target_frameworks @referenced_project_paths = referenced_project_paths end |
Instance Attribute Details
#properties ⇒ Object (readonly)
Returns the value of attribute properties.
62 63 64 |
# File 'lib/dependabot/nuget/native_discovery/native_project_discovery.rb', line 62 def properties @properties end |
#referenced_project_paths ⇒ Object (readonly)
Returns the value of attribute referenced_project_paths.
68 69 70 |
# File 'lib/dependabot/nuget/native_discovery/native_project_discovery.rb', line 68 def referenced_project_paths @referenced_project_paths end |
#target_frameworks ⇒ Object (readonly)
Returns the value of attribute target_frameworks.
65 66 67 |
# File 'lib/dependabot/nuget/native_discovery/native_project_discovery.rb', line 65 def target_frameworks @target_frameworks end |
Class Method Details
.from_json(json, directory) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/dependabot/nuget/native_discovery/native_project_discovery.rb', line 17 def self.from_json(json, directory) return nil if json.nil? file_path = File.join(directory, T.let(json.fetch("FilePath"), String)) properties = T.let(json.fetch("Properties"), T::Array[T::Hash[String, T.untyped]]).map do |prop| NativePropertyDetails.from_json(prop) end target_frameworks = T.let(json.fetch("TargetFrameworks"), T::Array[String]) referenced_project_paths = T.let(json.fetch("ReferencedProjectPaths"), T::Array[String]) dependencies = T.let(json.fetch("Dependencies"), T::Array[T::Hash[String, T.untyped]]).filter_map do |dep| details = NativeDependencyDetails.from_json(dep) next unless details.version # can't do anything without a version version = T.must(details.version) next unless version.length.positive? # can't do anything with an empty version next if version.include? "," # can't do anything with a range next if version.include? "*" # can't do anything with a wildcard details end NativeProjectDiscovery.new(file_path: file_path, properties: properties, target_frameworks: target_frameworks, referenced_project_paths: referenced_project_paths, dependencies: dependencies) end |
Instance Method Details
#dependency_set ⇒ Object
71 72 73 74 75 76 77 78 79 |
# File 'lib/dependabot/nuget/native_discovery/native_project_discovery.rb', line 71 def dependency_set if target_frameworks.empty? && file_path.end_with?("proj") Dependabot.logger.warn("Excluding project file '#{file_path}' due to unresolvable target framework") dependency_set = Dependabot::FileParsers::Base::DependencySet.new return dependency_set end super end |