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.



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

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.



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

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.



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

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


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

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.



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

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.



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

def priority
  10
end