Class: IronHammer::Projects::GenericProject

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ GenericProject

Returns a new instance of GenericProject.



11
12
13
14
15
16
# File 'lib/iron_hammer/projects/generic_project.rb', line 11

def initialize params={}
  @name = params[:name] ||
    raise(ArgumentError.new 'must provide a project name')
  @path = params[:path] || @name
  @csproj = params[:csproj] || "#{@name}.csproj"
end

Instance Attribute Details

#csprojObject

Returns the value of attribute csproj.



9
10
11
# File 'lib/iron_hammer/projects/generic_project.rb', line 9

def csproj
  @csproj
end

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

#pathObject

Returns the value of attribute path.



8
9
10
# File 'lib/iron_hammer/projects/generic_project.rb', line 8

def path
  @path
end

Instance Method Details

#artifactsObject



34
35
36
37
38
# File 'lib/iron_hammer/projects/generic_project.rb', line 34

def artifacts
  Dir[File.join(path_to_binaries, "#{assembly_name}.{dll,exe}")].map do |file|
    file.split(/\/|\\/).last
  end
end

#assembly_infoObject



44
45
46
# File 'lib/iron_hammer/projects/generic_project.rb', line 44

def assembly_info
  @assembly_info ||= AssemblyInfo.new(File.join @path, 'Properties', 'AssemblyInfo.cs')
end

#assembly_nameObject



40
41
42
# File 'lib/iron_hammer/projects/generic_project.rb', line 40

def assembly_name
  @assembly_name ||= file.assembly_name
end

#deliverables(params = {}) ⇒ Object



30
31
32
# File 'lib/iron_hammer/projects/generic_project.rb', line 30

def deliverables params={}
  []
end

#dependenciesObject



48
49
50
# File 'lib/iron_hammer/projects/generic_project.rb', line 48

def dependencies
  @dependencies ||= file.dependencies
end

#dependencies_with_projects(projects) ⇒ Object



56
57
58
59
# File 'lib/iron_hammer/projects/generic_project.rb', line 56

def dependencies_with_projects projects
  selected = projects.select {|p| p.is_a?(DllProject) && project_references.include?(p.name)}
  dependencies + selected.map {|p| Dependency.from_project p}.select {|p| !p.nil?}
end

#package(params = {}) ⇒ Object



61
62
63
64
# File 'lib/iron_hammer/projects/generic_project.rb', line 61

def package params={}
  package_root(params)
  Package.new :root => package_root, :deliverables => deliverables(params)
end

#path_to_binaries(params = {}) ⇒ Object



18
19
20
# File 'lib/iron_hammer/projects/generic_project.rb', line 18

def path_to_binaries params={}
  ''
end

#project_referencesObject



52
53
54
# File 'lib/iron_hammer/projects/generic_project.rb', line 52

def project_references
  @project_references ||= file.project_dependencies
end

#versionObject



22
23
24
# File 'lib/iron_hammer/projects/generic_project.rb', line 22

def version
  assembly_info.version || '1.0.0.0'
end

#version=(new_version) ⇒ Object



26
27
28
# File 'lib/iron_hammer/projects/generic_project.rb', line 26

def version= new_version
  assembly_info.version = new_version
end