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



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

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

.get_project_name(project_line) ⇒ Object



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

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

.parse(filename) ⇒ Object



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

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



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

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