Method: Puppet::Modulebuilder::Builder#metadata
- Defined in:
- lib/puppet/modulebuilder/builder.rb
#metadata ⇒ Hash{String => Object}
Read and parse the values from metadata.json for the module that is being built.
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 |
# File 'lib/puppet/modulebuilder/builder.rb', line 291 def return @metadata unless @metadata.nil? = File.join(source, 'metadata.json') unless file_exists?() raise ArgumentError, format("'%<file>s' does not exist or is not a file.", file: ) end unless file_readable?() raise ArgumentError, format("Unable to open '%<file>s' for reading.", file: ) end require 'json' begin @metadata = JSON.parse(read_file()) rescue JSON::JSONError => e raise ArgumentError, format('Invalid JSON in metadata.json: %<msg>s', msg: e.) end @metadata.freeze end |