Class: Dependabot::Nuget::FileFetcher::ImportPathsFinder
- Inherits:
-
Object
- Object
- Dependabot::Nuget::FileFetcher::ImportPathsFinder
- Defined in:
- lib/dependabot/nuget/file_fetcher/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.
12 13 14 |
# File 'lib/dependabot/nuget/file_fetcher/import_paths_finder.rb', line 12 def initialize(project_file:) @project_file = project_file end |
Instance Method Details
#import_paths ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/dependabot/nuget/file_fetcher/import_paths_finder.rb', line 16 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
26 27 28 29 30 31 32 33 34 |
# File 'lib/dependabot/nuget/file_fetcher/import_paths_finder.rb', line 26 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 |