Class: IronHammer::Anvil

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#solutionObject

Returns the value of attribute solution.



7
8
9
# File 'lib/iron_hammer/anvil.rb', line 7

def solution
  @solution
end

Class Method Details

.load_from(*path) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/iron_hammer/anvil.rb', line 9

def self.load_from *path
  target = path
  target = '.' if path.nil? || path.empty?
  pattern = File.join target, '*.sln'
  entries = Dir[pattern]
  anvil = Anvil.new(
    :solution => IronHammer::Solutions::Solution.new(
      :name => entries.first.split('/').pop.sub('.sln', ''),
      :file => IronHammer::Solutions::SolutionFile.parse_file(entries.first),
      :path => File.join(*path)
    )
  ) unless entries.nil? || entries.empty?
end

Instance Method Details

#dll_projectsObject



29
30
31
# File 'lib/iron_hammer/anvil.rb', line 29

def dll_projects
  @dll_projects ||= projects.select {|p| p.is_a? DllProject}
end

#integration_test_projectsObject



37
38
39
# File 'lib/iron_hammer/anvil.rb', line 37

def integration_test_projects
  test_projects.select {|p| p.name.include? 'Integration'}
end

#load_projects_from_solutionObject

deprecated!



45
46
47
48
# File 'lib/iron_hammer/anvil.rb', line 45

def load_projects_from_solution #deprecated!
  Kernel::warn '[DEPRECATION] `load_projects_from_solution` is deprecated and now it is a no-op. ' +
    'Please, just use `projects` instead - they will be loaded in a lazy fashion ;)'
end

#projectsObject



23
24
25
26
27
# File 'lib/iron_hammer/anvil.rb', line 23

def projects
  @projects ||= (@solution.file.projects.collect do |p|
    ProjectFile.load_from(root_path = @solution.path, project_path = p[:path], csproj = p[:csproj]).type.new(p)
  end)
end

#test_projectsObject



33
34
35
# File 'lib/iron_hammer/anvil.rb', line 33

def test_projects
  @test_projects ||= projects.select {|p| p.is_a? TestProject}
end

#unit_test_projectsObject



41
42
43
# File 'lib/iron_hammer/anvil.rb', line 41

def unit_test_projects
  test_projects - integration_test_projects
end