class Albacore::Solution
a solution encapsulates the properties from a sln file.
Attributes
content[R]
filename[R]
path_base[R]
Public Class Methods
new(path)
click to toggle source
# File lib/albacore/solution.rb, line 11 def initialize path raise ArgumentError, 'solution path does not exist' unless File.exists? path.to_s path = path.to_s unless path.is_a? String @content = open(path) @path_base, @filename = File.split path end
Public Instance Methods
path()
click to toggle source
get the path of the solution file
# File lib/albacore/solution.rb, line 31 def path File.join @path_base, @filename end
project_paths()
click to toggle source
# File lib/albacore/solution.rb, line 24 def project_paths project_matches.map { |matches| matches[:location] } .select { |path| File.extname(path).end_with? 'proj' } end
projects()
click to toggle source
# File lib/albacore/solution.rb, line 18 def projects project_paths.map { |path| File.join(@path_base, path) } .select { |path| File.file?(path) } .map {|path| Albacore::Project.new(File.absolute_path(path)) } end
to_s()
click to toggle source
Gets the path of the solution file
# File lib/albacore/solution.rb, line 36 def to_s path end
Private Instance Methods
project_matches()
click to toggle source
# File lib/albacore/solution.rb, line 42 def project_matches project_regexp = /^\s*Project\(.+\) = "(?<name>.+?)", "(?<location>.+?)", "(?<guid>.+?)"/ @content.map { |line| project_regexp.match(line) }.reject(&:nil?) end