Class: Dependabot::FileFetchers::Dotnet::Nuget::ImportPathsFinder
- Inherits:
-
Object
- Object
- Dependabot::FileFetchers::Dotnet::Nuget::ImportPathsFinder
- Defined in:
- lib/dependabot/file_fetchers/dotnet/nuget/import_paths_finder.rb
Instance Method Summary collapse
- #import_paths ⇒ Object
-
#initialize(project_file:) ⇒ ImportPathsFinder
constructor
A new instance of ImportPathsFinder.
- #project_reference_paths ⇒ Object
Constructor Details
#initialize(project_file:) ⇒ ImportPathsFinder
Returns a new instance of ImportPathsFinder.
13 14 15 |
# File 'lib/dependabot/file_fetchers/dotnet/nuget/import_paths_finder.rb', line 13 def initialize(project_file:) @project_file = project_file end |
Instance Method Details
#import_paths ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/dependabot/file_fetchers/dotnet/nuget/import_paths_finder.rb', line 17 def import_paths doc = Nokogiri::XML(project_file.content) doc.remove_namespaces! doc.xpath("/Project/Import").map do |import_node| path = import_node.attribute("Project").value.strip.tr("\\", "/") path = File.join(current_dir, path) unless current_dir.nil? Pathname.new(path).cleanpath.to_path end end |
#project_reference_paths ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/dependabot/file_fetchers/dotnet/nuget/import_paths_finder.rb', line 27 def project_reference_paths doc = Nokogiri::XML(project_file.content) doc.remove_namespaces! doc.xpath("/Project/ItemGroup/ProjectReference").map do |node| path = node.attribute("Include").value.strip.tr("\\", "/") path = File.join(current_dir, path) unless current_dir.nil? Pathname.new(path).cleanpath.to_path end end |