Class: Teapot::Project

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

Defined Under Namespace

Classes: Author

Instance Attribute Summary collapse

Attributes inherited from Definition

#context, #description, #package

Instance Method Summary collapse

Methods inherited from Definition

#path, #pretty_print, #to_s

Constructor Details

#initialize(context, package, name) ⇒ Project



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

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.



62
63
64
# File 'lib/teapot/project.rb', line 62

def authors
  @authors
end

#licenseObject

Returns the value of attribute license.



58
59
60
# File 'lib/teapot/project.rb', line 58

def license
  @license
end

#summaryObject

Returns the value of attribute summary.



57
58
59
# File 'lib/teapot/project.rb', line 57

def summary
  @summary
end

#titleObject

Returns the value of attribute title.



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

def title
  @title
end

#versionObject

Returns the value of attribute version.



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

def version
  @version
end

#websiteObject

Returns the value of attribute website.



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

def website
  @website
end

Instance Method Details

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



64
65
66
# File 'lib/teapot/project.rb', line 64

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

#freezeObject



44
45
46
47
48
49
50
51
52
53
54
# File 'lib/teapot/project.rb', line 44

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

#nameObject



34
35
36
37
38
39
40
41
42
# File 'lib/teapot/project.rb', line 34

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