Class: Souyuz::Msbuild::SolutionParser

Inherits:
Object
  • Object
show all
Defined in:
lib/souyuz/msbuild/solution_parser.rb

Class Method Summary collapse

Class Method Details

.get_project_file(project_line) ⇒ Object



29
30
31
# File 'lib/souyuz/msbuild/solution_parser.rb', line 29

def self.get_project_file(project_line)
  project_line.split("\"")[5].gsub('\\', '/')
end

.get_project_name(project_line) ⇒ Object



25
26
27
# File 'lib/souyuz/msbuild/solution_parser.rb', line 25

def self.get_project_name(project_line)
  project_line.split("\"")[3]
end

.parse(filename) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/souyuz/msbuild/solution_parser.rb', line 4

def self.parse(filename)
  solution = Solution.new

  File.open(filename) do |f|
    f.read.split("\n").each do |line|
      if line.start_with? "Project"
        options = parse_line line
        solution.add_project Project.new(options) # maybe we should not use the project class for this
      end
    end
  end

  return solution
end

.parse_line(line) ⇒ Object



19
20
21
22
23
# File 'lib/souyuz/msbuild/solution_parser.rb', line 19

def self.parse_line(line)
  name = get_project_name line
  project_file = get_project_file line
  return { project_name: name, project_path: project_file }
end