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', 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.
26 27 28 29 30 |
# File 'lib/abide_dev_utils/ppt/puppet_module.rb', line 26 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.
24 25 26 |
# File 'lib/abide_dev_utils/ppt/puppet_module.rb', line 24 def directory @directory end |
#special_files ⇒ Object (readonly)
Returns the value of attribute special_files.
24 25 26 |
# File 'lib/abide_dev_utils/ppt/puppet_module.rb', line 24 def special_files @special_files end |
Instance Method Details
#hiera_conf ⇒ Object
44 45 46 |
# File 'lib/abide_dev_utils/ppt/puppet_module.rb', line 44 def hiera_conf @hiera_conf ||= AbideDevUtils::Ppt::Hiera::Config.new end |
#metadata ⇒ Object
36 37 38 |
# File 'lib/abide_dev_utils/ppt/puppet_module.rb', line 36 def @metadata ||= JSON.parse(File.read(special_files[:metadata])) end |
#name(strip_namespace: false) ⇒ Object
32 33 34 |
# File 'lib/abide_dev_utils/ppt/puppet_module.rb', line 32 def name(strip_namespace: false) strip_namespace ? ['name'].split('-')[-1] : ['name'] end |
#supported_os ⇒ Object
40 41 42 |
# File 'lib/abide_dev_utils/ppt/puppet_module.rb', line 40 def supported_os @supported_os ||= find_supported_os end |