Class: Teapot::Project

Inherits:
Definition show all
Defined in:
lib/teapot/project.rb

Overview

A project definition.

Defined Under Namespace

Classes: Author

Instance Attribute Summary collapse

Attributes inherited from Definition

#context, #description, #package

Instance Method Summary collapse

Methods inherited from Definition

#inspect, #path, #to_s

Constructor Details

#initialize(context, package, name) ⇒ Project

Initialize a new project.



17
18
19
20
21
22
# File 'lib/teapot/project.rb', line 17

def initialize(context, package, name)
	super context, package, name
	
	@version = "0.0.0"
	@authors = []
end

Instance Attribute Details

#authorsObject (readonly)

Returns the value of attribute authors.



55
56
57
# File 'lib/teapot/project.rb', line 55

def authors
  @authors
end

#licenseObject

Returns the value of attribute license.



51
52
53
# File 'lib/teapot/project.rb', line 51

def license
  @license
end

#summaryObject

Returns the value of attribute summary.



50
51
52
# File 'lib/teapot/project.rb', line 50

def summary
  @summary
end

#titleObject

Returns the value of attribute title.



49
50
51
# File 'lib/teapot/project.rb', line 49

def title
  @title
end

#versionObject

Returns the value of attribute version.



53
54
55
# File 'lib/teapot/project.rb', line 53

def version
  @version
end

#websiteObject

Returns the value of attribute website.



52
53
54
# File 'lib/teapot/project.rb', line 52

def website
  @website
end

Instance Method Details

#add_author(name, options = {}) ⇒ Object

Add an author to the project.



60
61
62
# File 'lib/teapot/project.rb', line 60

def add_author(name, options = {})
	@authors << Author.new(name, options[:email], options[:website])
end

#freezeObject

Make the project immutable after all packages and configurations have been loaded.



37
38
39
40
41
42
43
44
45
46
47
# File 'lib/teapot/project.rb', line 37

def freeze
	@title.freeze
	@summary.freeze
	@license.freeze
	@website.freeze
	@version.freeze
	
	@authors.freeze
	
	super
end

#nameObject

Get the project name as a Build::Name object.



26
27
28
29
30
31
32
33
34
# File 'lib/teapot/project.rb', line 26

def name
	if @title
		# Prefer title, it retains case.
		Build::Name.new(@title)
	else
		# Otherwise, if we don't have title, use the target name.
		Build::Name.from_target(@name)
	end
end