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

Inherits:
Semantic::Dependency::ModuleRelease show all
Defined in:
lib/puppet/module_tool/installed_modules.rb

Instance Attribute Summary collapse

Attributes inherited from Semantic::Dependency::ModuleRelease

#name, #version

Instance Method Summary collapse

Methods inherited from Semantic::Dependency::ModuleRelease

#<=>, #priority, #to_s

Methods included from Semantic::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) ⇒ 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
82
83
# File 'lib/puppet/module_tool/installed_modules.rb', line 57

def initialize(source, mod)
  @mod = mod
  @metadata = mod.
  name = mod.forge_name.tr('/', '-')
  begin
    version = Semantic::Version.parse(mod.version)
  rescue Semantic::Version::ValidationFailure => e
    Puppet.warning "#{mod.name} (#{mod.path}) has an invalid version number (#{mod.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)."
    version = Semantic::Version.parse("0.0.0")
  end
  release = "#{name}@#{version}"

  super(source, name, version, {})

  if mod.dependencies
    mod.dependencies.each do |dep|
      results = Puppet::ModuleTool.parse_module_dependency(release, dep)
      dep_name, parsed_range, range = results

      dep.tap do |dep|
        add_constraint('initialize', dep_name, range.to_s) do |node|
          parsed_range === node.version
        end
      end
    end
  end
end

Instance Attribute Details

#metadataObject (readonly)



55
56
57
# File 'lib/puppet/module_tool/installed_modules.rb', line 55

def 
  @metadata
end

#modObject (readonly)



55
56
57
# File 'lib/puppet/module_tool/installed_modules.rb', line 55

def mod
  @mod
end

Instance Method Details

#install(dir) ⇒ Object



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

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

#install_dirObject



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

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

#prepareObject



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

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