Class: IronHammer::Projects::ProjectFile

Inherits:
Object
  • Object
show all
Defined in:
lib/iron_hammer/projects/project_file.rb

Constant Summary collapse

GUID_EVALUATION_ORDER =
[AspNetMvcProject, AspNetProject, TestProject]
GUID_PATH =
'//Project/PropertyGroup/ProjectTypeGuids'
ASSEMBLY_NAME_PATH =
'//Project/PropertyGroup/AssemblyName'
REFERENCE_PATH =
'//Reference[not(starts_with(@Include, "System"))]'
PROJECT_REFERENCE_PATH =
'//ProjectReference/Name'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#pathObject

Returns the value of attribute path.



13
14
15
# File 'lib/iron_hammer/projects/project_file.rb', line 13

def path
  @path
end

Class Method Details

.load_from(*path) ⇒ Object



21
22
23
# File 'lib/iron_hammer/projects/project_file.rb', line 21

def self.load_from *path
  ProjectFile.new path
end

Instance Method Details

#assembly_nameObject



31
32
33
# File 'lib/iron_hammer/projects/project_file.rb', line 31

def assembly_name
  @assembly_name ||= doc.elements[ASSEMBLY_NAME_PATH].text
end

#dependenciesObject



35
36
37
# File 'lib/iron_hammer/projects/project_file.rb', line 35

def dependencies
  references.collect { |reference| Dependency.from_reference reference }
end

#project_dependenciesObject



39
40
41
# File 'lib/iron_hammer/projects/project_file.rb', line 39

def project_dependencies
  project_references.collect { |name| name.text }
end

#typeObject



25
26
27
28
29
# File 'lib/iron_hammer/projects/project_file.rb', line 25

def type
  @type ||= ((GUID_EVALUATION_ORDER.inject(false) do |result, current|
    result || (guids.include?(ProjectTypes::guid_for(current)) && current)
  end) || DllProject)
end