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.


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

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.


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

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.


17
18
19
20
21
22
23
24
25
26
# File 'lib/puppet/module_tool/install_directory.rb', line 17

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