Class: Puppet::ModuleTool::InstalledModules Private

Inherits:
SemanticPuppet::Dependency::Source
  • 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.

Defined Under Namespace

Classes: ModuleRelease

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(env) ⇒ InstalledModules

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 InstalledModules.


14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/puppet/module_tool/installed_modules.rb', line 14

def initialize(env)
  @env = env
  modules = env.modules_by_path

  @fetched = []
  @modules = {}
  @by_name = {}
  env.modulepath.each do |path|
    modules[path].each do |mod|
      @by_name[mod.name] = mod
      next unless mod.has_metadata?
      release = ModuleRelease.new(self, mod)
      @modules[release.name] ||= release
    end
  end

  @modules.freeze
end

Instance Attribute Details

#by_nameObject (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.


8
9
10
# File 'lib/puppet/module_tool/installed_modules.rb', line 8

def by_name
  @by_name
end

#modulesObject (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.


8
9
10
# File 'lib/puppet/module_tool/installed_modules.rb', line 8

def modules
  @modules
end

Instance Method Details

#fetch(name) ⇒ Array<SemanticPuppet::Dependency::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.

Fetches ModuleRelease entries for each release of the named module.

Parameters:

  • name (String)

    the module name to look up

Returns:

  • (Array<SemanticPuppet::Dependency::ModuleRelease>)

    a list of releases for the given name

See Also:

  • SemanticPuppet::Dependency::Source#fetch

39
40
41
42
43
44
45
46
47
48
# File 'lib/puppet/module_tool/installed_modules.rb', line 39

def fetch(name)
  name = name.tr('/', '-')

  if @modules.key? name
    @fetched << name
    [ @modules[name] ]
  else
    [ ]
  end
end

#fetchedObject

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.


50
51
52
# File 'lib/puppet/module_tool/installed_modules.rb', line 50

def fetched
  @fetched
end

#priorityObject

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.


10
11
12
# File 'lib/puppet/module_tool/installed_modules.rb', line 10

def priority
  10
end