Class: Puppet::ModuleTool::InstalledModules::ModuleRelease Private

Inherits:
SemanticPuppet::Dependency::ModuleRelease
  • Object
show all
Defined in:
lib/puppet/module_tool/installed_modules.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source, mod) ⇒ ModuleRelease

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of ModuleRelease.



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/puppet/module_tool/installed_modules.rb', line 60

def initialize(source, mod)
  @mod = mod
  @metadata = mod.
  name = mod.forge_name.tr('/', '-')
  begin
    version = SemanticPuppet::Version.parse(mod.version)
  rescue SemanticPuppet::Version::ValidationFailure
    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)
      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

#metadataObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



58
59
60
# File 'lib/puppet/module_tool/installed_modules.rb', line 58

def 
  @metadata
end

#modObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



58
59
60
# File 'lib/puppet/module_tool/installed_modules.rb', line 58

def mod
  @mod
end

Instance Method Details

#install(dir) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



90
91
92
# File 'lib/puppet/module_tool/installed_modules.rb', line 90

def install(dir)
  # If we're already installed, there's no need for us to faff about.
end

#install_dirObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



86
87
88
# File 'lib/puppet/module_tool/installed_modules.rb', line 86

def install_dir
  Pathname.new(@mod.path).dirname
end

#prepareObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



94
95
96
# File 'lib/puppet/module_tool/installed_modules.rb', line 94

def prepare
  # We're already installed; what preparation remains?
end