Class: Puppet::ModuleTool::InstallDirectory

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

Overview

Control the install location for modules.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(target) ⇒ InstallDirectory

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)

Returns the value of attribute target.



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

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