Class: Puppet::ModuleTool::Metadata
Overview
This class provides a data structure representing a module’s metadata. It provides some basic parsing, but other data is injected into it using annotate methods in other classes.
Instance Attribute Summary collapse
Instance Method Summary
collapse
#requiredopts, #set_options, #symbolize_options
Constructor Details
#initialize(settings = {}) ⇒ Metadata
Instantiate from a hash, whose keys are setters in this class.
26
27
28
|
# File 'lib/puppet/module_tool/metadata.rb', line 26
def initialize(settings={})
set_options(settings)
end
|
Instance Attribute Details
#full_module_name ⇒ Object
The full name of the module, which is a dash-separated combination of the username and module name.
14
15
16
|
# File 'lib/puppet/module_tool/metadata.rb', line 14
def full_module_name
@full_module_name
end
|
The name of this module. See also full_module_name.
20
21
22
|
# File 'lib/puppet/module_tool/metadata.rb', line 20
def name
@name
end
|
The name of the user that owns this module.
17
18
19
|
# File 'lib/puppet/module_tool/metadata.rb', line 17
def username
@username
end
|
The version of this module.
23
24
25
|
# File 'lib/puppet/module_tool/metadata.rb', line 23
def version
@version
end
|
Instance Method Details
42
43
44
|
# File 'lib/puppet/module_tool/metadata.rb', line 42
def author
@author || @username
end
|
#author=(author) ⇒ Object
46
47
48
|
# File 'lib/puppet/module_tool/metadata.rb', line 46
def author=(author)
@author = author
end
|
#checksums ⇒ Object
Return module’s file checksums.
105
106
107
|
# File 'lib/puppet/module_tool/metadata.rb', line 105
def checksums
return @checksums ||= {}
end
|
#dashed_name ⇒ Object
Return the dashed name of the module, which may either be the dash-separated combination of the username and module name, or just the module name.
112
113
114
|
# File 'lib/puppet/module_tool/metadata.rb', line 112
def dashed_name
return [@username, @name].compact.join('-')
end
|
#dependencies ⇒ Object
Return an array of the module’s Dependency objects.
38
39
40
|
# File 'lib/puppet/module_tool/metadata.rb', line 38
def dependencies
return @dependencies ||= []
end
|
#description ⇒ Object
74
75
76
|
# File 'lib/puppet/module_tool/metadata.rb', line 74
def description
@description || 'UNKNOWN'
end
|
#description=(description) ⇒ Object
78
79
80
|
# File 'lib/puppet/module_tool/metadata.rb', line 78
def description=(description)
@description = description
end
|
82
83
84
|
# File 'lib/puppet/module_tool/metadata.rb', line 82
def
|| {}
end
|
86
87
88
|
# File 'lib/puppet/module_tool/metadata.rb', line 86
def ()
=
end
|
58
59
60
|
# File 'lib/puppet/module_tool/metadata.rb', line 58
def license
@license || 'Apache License, Version 2.0'
end
|
#license=(license) ⇒ Object
62
63
64
|
# File 'lib/puppet/module_tool/metadata.rb', line 62
def license=(license)
@license = license
end
|
#project_page ⇒ Object
90
91
92
|
# File 'lib/puppet/module_tool/metadata.rb', line 90
def project_page
@project_page || 'UNKNOWN'
end
|
#project_page=(project_page) ⇒ Object
94
95
96
|
# File 'lib/puppet/module_tool/metadata.rb', line 94
def project_page=(project_page)
@project_page = project_page
end
|
#release_name ⇒ Object
Return the release name, which is the combination of the dashed_name of the module and its version number.
118
119
120
|
# File 'lib/puppet/module_tool/metadata.rb', line 118
def release_name
return [dashed_name, @version].join('-')
end
|
50
51
52
|
# File 'lib/puppet/module_tool/metadata.rb', line 50
def source
@source || 'UNKNOWN'
end
|
#source=(source) ⇒ Object
54
55
56
|
# File 'lib/puppet/module_tool/metadata.rb', line 54
def source=(source)
@source = source
end
|
66
67
68
|
# File 'lib/puppet/module_tool/metadata.rb', line 66
def summary
@summary || 'UNKNOWN'
end
|
#summary=(summary) ⇒ Object
70
71
72
|
# File 'lib/puppet/module_tool/metadata.rb', line 70
def summary=(summary)
@summary = summary
end
|
#to_data_hash ⇒ Object
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
|
# File 'lib/puppet/module_tool/metadata.rb', line 132
def to_data_hash()
return .merge({
'name' => @full_module_name,
'version' => @version,
'source' => source,
'author' => author,
'license' => license,
'summary' => summary,
'description' => description,
'project_page' => project_page,
'dependencies' => dependencies,
'types' => types,
'checksums' => checksums
})
end
|
148
149
150
|
# File 'lib/puppet/module_tool/metadata.rb', line 148
def to_hash()
to_data_hash
end
|
#to_pson(*args) ⇒ Object
Return the PSON record representing this instance.
153
154
155
|
# File 'lib/puppet/module_tool/metadata.rb', line 153
def to_pson(*args)
return to_data_hash.to_pson(*args)
end
|
Return an array of the module’s Puppet types, each one is a hash containing :name and :doc.
100
101
102
|
# File 'lib/puppet/module_tool/metadata.rb', line 100
def types
return @types ||= []
end
|