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
# File 'lib/puppet/module_tool/installed_modules.rb', line 57

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



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

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

#install_dirObject



80
81
82
# File 'lib/puppet/module_tool/installed_modules.rb', line 80

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

#prepareObject



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

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