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
- #author ⇒ Object
- #author=(author) ⇒ Object
-
#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.
- #description ⇒ Object
- #description=(description) ⇒ Object
-
#initialize(settings = {}) ⇒ Metadata
constructor
Instantiate from a hash, whose keys are setters in this class.
- #license ⇒ Object
- #license=(license) ⇒ Object
- #project_page ⇒ Object
- #project_page=(project_page) ⇒ Object
-
#release_name ⇒ Object
Return the release name, which is the combination of the
dashed_name
of the module and itsversion
number. - #source ⇒ Object
- #source=(source) ⇒ Object
- #summary ⇒ Object
- #summary=(summary) ⇒ Object
-
#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
#author ⇒ Object
42 43 44 |
# File 'lib/puppet/module/tool/metadata.rb', line 42 def @author || @username end |
#author=(author) ⇒ Object
46 47 48 |
# File 'lib/puppet/module/tool/metadata.rb', line 46 def () @author = end |
#checksums ⇒ Object
Return module’s file checksums.
98 99 100 |
# File 'lib/puppet/module/tool/metadata.rb', line 98 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
.
105 106 107 |
# File 'lib/puppet/module/tool/metadata.rb', line 105 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 |
#license ⇒ Object
58 59 60 |
# File 'lib/puppet/module/tool/metadata.rb', line 58 def license @license || 'UNKNOWN' 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
82 83 84 |
# File 'lib/puppet/module/tool/metadata.rb', line 82 def project_page @project_page || 'UNKNOWN' end |
#project_page=(project_page) ⇒ Object
86 87 88 |
# File 'lib/puppet/module/tool/metadata.rb', line 86 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.
111 112 113 |
# File 'lib/puppet/module/tool/metadata.rb', line 111 def release_name return [dashed_name, @version].join('-') end |
#source ⇒ Object
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 |
#summary ⇒ Object
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_pson(*args) ⇒ Object
Return the PSON record representing this instance.
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/puppet/module/tool/metadata.rb', line 116 def to_pson(*args) return { :name => @full_name, :version => @version, :source => source, :author => , :license => license, :summary => summary, :description => description, :project_page => project_page, :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?
93 94 95 |
# File 'lib/puppet/module/tool/metadata.rb', line 93 def types return @types ||= [] end |