Module: CemAcpt::Utils::Puppet

Defined in:
lib/cem_acpt/utils/puppet.rb

Overview

Puppet-related utilities

Class Method Summary collapse

Class Method Details

.build_module_package(module_dir, target_dir = nil, should_log: false) ⇒ String

Builds a Puppet module package.

Parameters:

  • module_dir (String)

    Path to the module directory. If target_dir is specified as a relative path, it will be relative to the module dir.

  • target_dir (String) (defaults to: nil)

    Path to the target directory where the package will be built. This defaults to the relative path ‘pkg/’.

  • should_log (Boolean) (defaults to: false)

    Whether or not to log the build process.

Returns:

  • (String)

    Path to the built package.



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

def self.build_module_package(module_dir, target_dir = nil, should_log: false)
  builder_logger = should_log ? logger : nil
  builder = ::Puppet::Modulebuilder::Builder.new(::File.expand_path(module_dir), target_dir, builder_logger)

  # Validates module metadata by raising exception if invalid
   = builder.

  # Builds the module package
  builder.build
end