Class: ProviderMetadata

Inherits:
Object
  • Object
show all
Includes:
Common
Defined in:
lib/bento/providermetadata.rb

Instance Method Summary collapse

Methods included from Common

#banner, #box_metadata, #build_list, #builds_yml, #duration, #info, #macos?, #metadata_files, #private_box?, #unix?, #vc_account, #warn, #windows?

Constructor Details

#initialize(path, box_basename) ⇒ ProviderMetadata

Returns a new instance of ProviderMetadata.



7
8
9
# File 'lib/bento/providermetadata.rb', line 7

def initialize(path, box_basename)
  @base = File.join(path, box_basename)
end

Instance Method Details

#readObject



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/bento/providermetadata.rb', line 11

def read
  Dir.glob("#{base}.*.box").map do |file|
    {
      name: provider_from_file(file),
      version: version(provider_from_file(file)),
      file: "#{File.basename(file)}",
      checksum_type: "sha256",
      checksum: shasum(file),
      size: "#{size_in_mb(file)} MB",
    }
  end
end