Class: Puppet::ModuleTool::InstalledModules::ModuleRelease
- Inherits:
-
SemanticPuppet::Dependency::ModuleRelease
- Object
- SemanticPuppet::Dependency::ModuleRelease
- Puppet::ModuleTool::InstalledModules::ModuleRelease
- Defined in:
- lib/puppet/module_tool/installed_modules.rb
Instance Attribute Summary collapse
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#mod ⇒ Object
readonly
Returns the value of attribute mod.
Attributes inherited from SemanticPuppet::Dependency::ModuleRelease
Instance Method Summary collapse
-
#initialize(source, mod, strict_semver = true) ⇒ ModuleRelease
constructor
A new instance of ModuleRelease.
- #install(dir) ⇒ Object
- #install_dir ⇒ Object
- #prepare ⇒ Object
Methods inherited from SemanticPuppet::Dependency::ModuleRelease
#<=>, #eql?, #hash, #priority, #to_s
Methods included from SemanticPuppet::Dependency::GraphNode
#<<, #<=>, #add_constraint, #add_dependency, #children, #constraints, #constraints_for, #dependencies, #dependency_names, #name, #populate_children, #satisfied?, #satisfies_constraints?, #satisfies_dependency?
Constructor Details
#initialize(source, mod, strict_semver = true) ⇒ ModuleRelease
Returns a new instance of ModuleRelease.
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/puppet/module_tool/installed_modules.rb', line 57 def initialize(source, mod, strict_semver = true) @mod = mod @metadata = mod. name = mod.forge_name.tr('/', '-') begin version = SemanticPuppet::Version.parse(mod.version) rescue SemanticPuppet::Version::ValidationFailure => e Puppet.warning _("%{module_name} (%{path}) has an invalid version number (%{version}). The version has been set to 0.0.0. If you are the maintainer for this module, please update the metadata.json with a valid Semantic Version (http://semver.org).") % { module_name: mod.name, path: mod.path, version: mod.version } version = SemanticPuppet::Version.parse("0.0.0") end release = "#{name}@#{version}" super(source, name, version, {}) if mod.dependencies mod.dependencies.each do |dependency| results = Puppet::ModuleTool.parse_module_dependency(release, dependency, strict_semver) dep_name, parsed_range, range = results add_constraint('initialize', dep_name, range.to_s) do |node| parsed_range === node.version end end end end |
Instance Attribute Details
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
55 56 57 |
# File 'lib/puppet/module_tool/installed_modules.rb', line 55 def @metadata end |
#mod ⇒ Object (readonly)
Returns the value of attribute mod.
55 56 57 |
# File 'lib/puppet/module_tool/installed_modules.rb', line 55 def mod @mod end |
Instance Method Details
#install(dir) ⇒ Object
87 88 89 |
# File 'lib/puppet/module_tool/installed_modules.rb', line 87 def install(dir) # If we're already installed, there's no need for us to faff about. end |
#install_dir ⇒ Object
83 84 85 |
# File 'lib/puppet/module_tool/installed_modules.rb', line 83 def install_dir Pathname.new(@mod.path).dirname end |
#prepare ⇒ Object
91 92 93 |
# File 'lib/puppet/module_tool/installed_modules.rb', line 91 def prepare # We're already installed; what preparation remains? end |