Sha256: ea658091fcb0e4e9f5722e2baba95ac6b4223bc2a2c908f02c3f020619a936fd
Contents?: true
Size: 1003 Bytes
Versions: 12
Compression:
Stored size: 1003 Bytes
Contents
# frozen_string_literal: true module Spandx module Dotnet module Parsers class Sln < ::Spandx::Core::Parser def match?(path) path.extname == '.sln' end def parse(path) project_paths_from(path).map do |project_path| ::Spandx::Core::Parser.parse(project_path) end.flatten end private def project_paths_from(path) path.each_line.map do |line| next unless project_line?(line) project_path = project_path_from(line) next unless project_path path.dirname.join(project_path).cleanpath.to_path end.compact end def project_line?(line) line.match?(/^\s*Project\(/) end def project_path_from(line) path = line.split('"')[5] return unless path path = path.tr('\\', '/') path.match?(/\.[a-z]{2}proj$/) ? path : nil end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems