Class: IronHammer::Solutions::SolutionFile

Inherits:
Object
  • Object
show all
Defined in:
lib/iron_hammer/solutions/solution_file.rb

Constant Summary collapse

NAME_PATH_CSPROJ =
/.* = \"(.+)\"\, \"(.+)\\(.+\.csproj)\", .*/
STOP_TRIGGER =
/^Global/

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(projects = []) ⇒ SolutionFile

Returns a new instance of SolutionFile.



11
12
13
# File 'lib/iron_hammer/solutions/solution_file.rb', line 11

def initialize projects=[]
  @projects = projects
end

Instance Attribute Details

#projectsObject

Returns the value of attribute projects.



6
7
8
# File 'lib/iron_hammer/solutions/solution_file.rb', line 6

def projects
  @projects
end

Class Method Details

.parse(lines) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/iron_hammer/solutions/solution_file.rb', line 15

def self.parse lines
  projects = []
  lines.each do |line|
    break if STOP_TRIGGER =~ line
    line.scan(NAME_PATH_CSPROJ) do |name, path, csproj|
      projects << { :name => name, :path => path, :csproj => csproj }
    end
  end
  SolutionFile.new projects
end

.parse_file(*path) ⇒ Object



26
27
28
# File 'lib/iron_hammer/solutions/solution_file.rb', line 26

def self.parse_file *path
  self.parse IronHammer::Utils::FileSystem::read_lines(*path)
end