Class: Puppet::ModuleTool::InstallDirectory Private

Inherits:
Object
  • Object
show all
Includes:
Errors
Defined in:
lib/puppet/module_tool/install_directory.rb

Overview

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.

Control the install location for modules.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(target) ⇒ InstallDirectory

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



14
15
16
# File 'lib/puppet/module_tool/install_directory.rb', line 14

def initialize(target)
  @target = target
end

Instance Attribute Details

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



12
13
14
# File 'lib/puppet/module_tool/install_directory.rb', line 12

def target
  @target
end

Instance Method Details

#prepare(module_name, version) ⇒ 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.

prepare the module install location. This will create the location if needed.



20
21
22
23
24
25
26
27
28
29
# File 'lib/puppet/module_tool/install_directory.rb', line 20

def prepare(module_name, version)
  return if @target.directory?

  begin
    @target.mkpath
    Puppet.notice _("Created target directory %{dir}") % { dir: @target }
  rescue SystemCallError => orig_error
    raise converted_to_friendly_error(module_name, version, orig_error)
  end
end