lib/spandx/java/parsers/maven.rb in spandx-0.13.3 vs lib/spandx/java/parsers/maven.rb in spandx-0.13.4

- old
+ new

@@ -2,29 +2,29 @@ module Spandx module Java module Parsers class Maven < ::Spandx::Core::Parser - def matches?(filename) - File.basename(filename) == 'pom.xml' + def match?(path) + path.basename.fnmatch?('pom.xml') end - def parse(filename) - document = Nokogiri.XML(IO.read(filename)).tap(&:remove_namespaces!) + def parse(path) + document = Nokogiri.XML(path.read).tap(&:remove_namespaces!) document.search('//project/dependencies/dependency').map do |node| - map_from(node) + map_from(path, node) end end private - def map_from(node) + def map_from(path, node) artifact_id = node.at_xpath('./artifactId').text group_id = node.at_xpath('./groupId').text version = node.at_xpath('./version').text ::Spandx::Core::Dependency.new( - package_manager: :maven, + path: path, name: "#{group_id}:#{artifact_id}", version: version ) end end