Sha256: 54af3a06f1f75bc571b432c3c1c9a93fc0ebec4344c0aea6509eb0ea8e8cb385
Contents?: true
Size: 998 Bytes
Versions: 5
Compression:
Stored size: 998 Bytes
Contents
# frozen_string_literal: true module Spandx module Parsers class Sln < Base def self.matches?(filename) filename.match?(/.*\.sln/) end def parse(file_path) project_paths_from(file_path).map do |path| Parsers .for(path, catalogue: catalogue) .parse(path) end.flatten end private def project_paths_from(file_path) IO.readlines(file_path).map do |line| next unless project_line?(line) path = project_path_from(line) next unless path path = File.join(File.dirname(file_path), path) Pathname.new(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
Version data entries
5 entries across 5 versions & 1 rubygems