Class: CemAcpt::Utils::Puppet::ModulePackageBuilder
- Inherits:
-
Object
- Object
- CemAcpt::Utils::Puppet::ModulePackageBuilder
- Includes:
- Logging
- Defined in:
- lib/cem_acpt/utils/puppet.rb
Constant Summary
Constants included from Logging
Instance Attribute Summary collapse
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#module_dir ⇒ Object
readonly
Returns the value of attribute module_dir.
-
#package_path ⇒ Object
readonly
Returns the value of attribute package_path.
-
#should_log ⇒ Object
readonly
Returns the value of attribute should_log.
-
#target_dir ⇒ Object
readonly
Returns the value of attribute target_dir.
Instance Method Summary collapse
-
#build ⇒ String
Builds a Puppet module package.
-
#initialize(module_dir, target_dir: nil, should_log: false, builder: ::Puppet::Modulebuilder::Builder) ⇒ ModulePackageBuilder
constructor
A new instance of ModulePackageBuilder.
-
#package_built? ⇒ Boolean
Determines if a package has been built.
Methods included from Logging
current_log_config, #current_log_config, current_log_format, #current_log_format, #current_log_level, current_log_level, included, #logger, logger, new_log_config, #new_log_config, new_log_formatter, #new_log_formatter, #new_log_level, new_log_level, #new_logger, new_logger, verbose?, #verbose?
Constructor Details
#initialize(module_dir, target_dir: nil, should_log: false, builder: ::Puppet::Modulebuilder::Builder) ⇒ ModulePackageBuilder
Returns a new instance of ModulePackageBuilder.
16 17 18 19 20 21 22 23 24 |
# File 'lib/cem_acpt/utils/puppet.rb', line 16 def initialize(module_dir, target_dir: nil, should_log: false, builder: ::Puppet::Modulebuilder::Builder) @module_dir = ::File.(module_dir) @target_dir = target_dir @should_log = should_log @builder = new_builder(builder) @metadata = @builder. # Validates metadata @package_built = false @package_path = nil end |
Instance Attribute Details
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
14 15 16 |
# File 'lib/cem_acpt/utils/puppet.rb', line 14 def @metadata end |
#module_dir ⇒ Object (readonly)
Returns the value of attribute module_dir.
14 15 16 |
# File 'lib/cem_acpt/utils/puppet.rb', line 14 def module_dir @module_dir end |
#package_path ⇒ Object (readonly)
Returns the value of attribute package_path.
14 15 16 |
# File 'lib/cem_acpt/utils/puppet.rb', line 14 def package_path @package_path end |
#should_log ⇒ Object (readonly)
Returns the value of attribute should_log.
14 15 16 |
# File 'lib/cem_acpt/utils/puppet.rb', line 14 def should_log @should_log end |
#target_dir ⇒ Object (readonly)
Returns the value of attribute target_dir.
14 15 16 |
# File 'lib/cem_acpt/utils/puppet.rb', line 14 def target_dir @target_dir end |
Instance Method Details
#build ⇒ String
Builds a Puppet module package.
28 29 30 31 32 33 |
# File 'lib/cem_acpt/utils/puppet.rb', line 28 def build @package_path = @metadata['name'].include?('windows') ? build_windows_package : @builder.build @package_built = true logger.info('CemAcpt::Utils::Puppet::ModulePackageBuilder') { "Built module package: #{@package_path}" } @package_path end |
#package_built? ⇒ Boolean
Determines if a package has been built.
36 37 38 |
# File 'lib/cem_acpt/utils/puppet.rb', line 36 def package_built? @package_built end |