Class: R10K::Module::MetadataFile
- Inherits:
-
Object
- Object
- R10K::Module::MetadataFile
- Defined in:
- lib/r10k/module/metadata_file.rb
Instance Method Summary collapse
-
#exist? ⇒ Boolean
Does the metadata file itself exist?.
-
#initialize(metadata_file_path) ⇒ MetadataFile
constructor
A new instance of MetadataFile.
-
#read(metadata_file_path = @metadata_file_path) ⇒ Puppet::ModuleTool::Metadata
The metadata object created by the metadatafile.
Constructor Details
#initialize(metadata_file_path) ⇒ MetadataFile
Returns a new instance of MetadataFile.
8 9 10 |
# File 'lib/r10k/module/metadata_file.rb', line 8 def initialize() @metadata_file_path = end |
Instance Method Details
#exist? ⇒ Boolean
Does the metadata file itself exist?
13 14 15 |
# File 'lib/r10k/module/metadata_file.rb', line 13 def exist? @metadata_file_path.file? and @metadata_file_path.readable? end |
#read(metadata_file_path = @metadata_file_path) ⇒ Puppet::ModuleTool::Metadata
Returns The metadata object created by the metadatafile.
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/r10k/module/metadata_file.rb', line 18 def read( = @metadata_file_path) if self.exist? .open do |f| begin = PuppetForge::Metadata.new .update(JSON.load(f), false) rescue JSON::ParserError => e exception = R10K::Error.wrap(e, _("Could not read metadata.json")) raise exception end end end end |