Class: AbideDevUtils::Ppt::PuppetModule
- Inherits:
-
Object
- Object
- AbideDevUtils::Ppt::PuppetModule
- Defined in:
- lib/abide_dev_utils/ppt/puppet_module.rb
Overview
Class for working with Puppet Modules
Constant Summary collapse
- DEF_FILES =
{ metadata: 'metadata.json', readme: 'README.md', reference: 'REFERENCE.md', changelog: 'CHANGELOG.md', hiera_config: 'hiera.yaml', fixtures: '.fixtures.yml', rubocop: '.rubocop.yml', sync: '.sync.yml', pdkignore: '.pdkignore', gitignore: '.gitignore' }.freeze
Instance Attribute Summary collapse
-
#directory ⇒ Object
readonly
Returns the value of attribute directory.
-
#special_files ⇒ Object
readonly
Returns the value of attribute special_files.
Instance Method Summary collapse
- #hiera_conf ⇒ Object
-
#initialize(directory = Dir.pwd) ⇒ PuppetModule
constructor
A new instance of PuppetModule.
- #metadata ⇒ Object
- #name(strip_namespace: false) ⇒ Object
- #supported_os ⇒ Object
Constructor Details
#initialize(directory = Dir.pwd) ⇒ PuppetModule
Returns a new instance of PuppetModule.
27 28 29 30 31 |
# File 'lib/abide_dev_utils/ppt/puppet_module.rb', line 27 def initialize(directory = Dir.pwd) AbideDevUtils::Validate.directory(directory) @directory = directory @special_files = DEF_FILES.dup.transform_values { |v| File.(File.join(@directory, v)) } end |
Instance Attribute Details
#directory ⇒ Object (readonly)
Returns the value of attribute directory.
25 26 27 |
# File 'lib/abide_dev_utils/ppt/puppet_module.rb', line 25 def directory @directory end |
#special_files ⇒ Object (readonly)
Returns the value of attribute special_files.
25 26 27 |
# File 'lib/abide_dev_utils/ppt/puppet_module.rb', line 25 def special_files @special_files end |
Instance Method Details
#hiera_conf ⇒ Object
45 46 47 |
# File 'lib/abide_dev_utils/ppt/puppet_module.rb', line 45 def hiera_conf @hiera_conf ||= AbideDevUtils::Ppt::Hiera::Config.new(special_files[:hiera_config]) end |
#metadata ⇒ Object
37 38 39 |
# File 'lib/abide_dev_utils/ppt/puppet_module.rb', line 37 def @metadata ||= JSON.parse(File.read(special_files[:metadata])) end |
#name(strip_namespace: false) ⇒ Object
33 34 35 |
# File 'lib/abide_dev_utils/ppt/puppet_module.rb', line 33 def name(strip_namespace: false) strip_namespace ? ['name'].split('-')[-1] : ['name'] end |
#supported_os ⇒ Object
41 42 43 |
# File 'lib/abide_dev_utils/ppt/puppet_module.rb', line 41 def supported_os @supported_os ||= find_supported_os end |