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 Method Summary collapse

Constructor Details

#initialize(target_directory) ⇒ InstallDirectory

Returns a new instance of InstallDirectory.



7
8
9
# File 'lib/puppet/module_tool/install_directory.rb', line 7

def initialize(target_directory)
  @target_directory = target_directory
end

Instance Method Details

#prepare(module_name, version) ⇒ Object

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



13
14
15
16
17
18
19
20
21
22
# File 'lib/puppet/module_tool/install_directory.rb', line 13

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

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