Class: Puppet::Module::Tool::Metadata
- Inherits:
-
Object
- Object
- Puppet::Module::Tool::Metadata
- Defined in:
- lib/puppet/module/tool/metadata.rb
Overview
Metadata
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
-
#full_name ⇒ Object
The full name of the module, which is a dash-separated combination of the
username
and modulename
. -
#name ⇒ Object
readonly
The name of this module.
-
#username ⇒ Object
readonly
The name of the user that owns this module.
-
#version ⇒ Object
The version of this module, a string like ‘0.1.0’.
Instance Method Summary collapse
-
#checksums ⇒ Object
Return module’s file checksums.
-
#dashed_name ⇒ Object
Return the dashed name of the module, which may either be the dash-separated combination of the
username
and modulename
, or just the modulename
. -
#dependencies ⇒ Object
Return an array of the module’s Dependency objects.
-
#initialize(settings = {}) ⇒ Metadata
constructor
Instantiate from a hash, whose keys are setters in this class.
-
#release_name ⇒ Object
Return the release name, which is the combination of the
dashed_name
of the module and itsversion
number. -
#to_pson(*args) ⇒ Object
Return the PSON record representing this instance.
-
#types ⇒ Object
Return an array of the module’s Puppet types, each one is a hash containing :name and :doc.
Constructor Details
#initialize(settings = {}) ⇒ Metadata
Instantiate from a hash, whose keys are setters in this class.
24 25 26 27 28 |
# File 'lib/puppet/module/tool/metadata.rb', line 24 def initialize(settings={}) settings.each do |key, value| send("#{key}=", value) end end |
Instance Attribute Details
#full_name ⇒ Object
The full name of the module, which is a dash-separated combination of the username
and module name
.
12 13 14 |
# File 'lib/puppet/module/tool/metadata.rb', line 12 def full_name @full_name end |
#name ⇒ Object (readonly)
The name of this module. See also full_name
.
18 19 20 |
# File 'lib/puppet/module/tool/metadata.rb', line 18 def name @name end |
#username ⇒ Object (readonly)
The name of the user that owns this module.
15 16 17 |
# File 'lib/puppet/module/tool/metadata.rb', line 15 def username @username end |
#version ⇒ Object
The version of this module, a string like ‘0.1.0’.
21 22 23 |
# File 'lib/puppet/module/tool/metadata.rb', line 21 def version @version end |
Instance Method Details
#checksums ⇒ Object
Return module’s file checksums.
50 51 52 |
# File 'lib/puppet/module/tool/metadata.rb', line 50 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
.
57 58 59 |
# File 'lib/puppet/module/tool/metadata.rb', line 57 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 |
#release_name ⇒ Object
Return the release name, which is the combination of the dashed_name
of the module and its version
number.
63 64 65 |
# File 'lib/puppet/module/tool/metadata.rb', line 63 def release_name return [dashed_name, @version].join('-') end |
#to_pson(*args) ⇒ Object
Return the PSON record representing this instance.
68 69 70 71 72 73 74 75 76 |
# File 'lib/puppet/module/tool/metadata.rb', line 68 def to_pson(*args) return { :name => @full_name, :version => @version, :dependencies => dependencies, :types => types, :checksums => checksums }.to_pson(*args) end |
#types ⇒ Object
Return an array of the module’s Puppet types, each one is a hash containing :name and :doc. TODO Shouldn’t this be it’s own class?
45 46 47 |
# File 'lib/puppet/module/tool/metadata.rb', line 45 def types return @types ||= [] end |