Class: Logirel::VS::Project

Inherits:
Object
  • Object
show all
Defined in:
lib/logirel/vs/solution.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(prfile, opts = {}) ⇒ Project

Returns a new instance of Project.



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/logirel/vs/solution.rb', line 13

def initialize(prfile, opts = {})
  @file = File.expand_path("#{prfile}")
  @name = File.basename(@file, ".csproj")

  @solution_path = opts[:solution_path] || '.'
  @project_types = []

  throw "Project #{@file} must exist." unless File.exists? @file

  parse(File.read(@file))
end

Instance Attribute Details

#fileObject (readonly)

Returns the value of attribute file.



9
10
11
# File 'lib/logirel/vs/solution.rb', line 9

def file
  @file
end

#nameObject (readonly)

Returns the value of attribute name.



8
9
10
# File 'lib/logirel/vs/solution.rb', line 8

def name
  @name
end

#outputObject (readonly)

Returns the value of attribute output.



10
11
12
# File 'lib/logirel/vs/solution.rb', line 10

def output
  @output
end

#project_typesObject (readonly)

Returns the value of attribute project_types.



11
12
13
# File 'lib/logirel/vs/solution.rb', line 11

def project_types
  @project_types
end

Instance Method Details

#directoryObject



25
26
27
# File 'lib/logirel/vs/solution.rb', line 25

def directory
  File.dirname(file)
end

#test?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/logirel/vs/solution.rb', line 29

def test?
  project_types.any? {|t| ProjectTypes.test? t } 
end

#web?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/logirel/vs/solution.rb', line 33

def web?
  project_types.any? {|t| ProjectTypes.web? t } 
end