class Vara::Metadata::CompiledPackages

“Struct” representing the information about the compiled_packages field in metadata.yml @example entry from metadata.yml

compiled_package:
  name: cf
  file: cf-170-bosh-vsphere-esxi-ubuntu-2366.tgz
  version: "170"
  md5: 048f9e546bb2bb490f44cd9ea074b22a
  url: https://s3-us-west-1.amazonaws.com/releng-artifacts/cf-170-build-99/cf-170-bosh-vsphere-esxi-ubuntu-2366.tgz

Attributes

basename[R]

The filename of the compiled package @return [String]

md5[R]

Checksum of the compiled_packages tarball @return [String]

name[R]

The name field of the YAML. Typically the name of the contained release. @return [String]

sha1[R]

SHA1 Checksum is not supported for compiled_packages @return nil

version[R]

The version field of the YAML. Typically the version of the contained release. @return [String]

Public Class Methods

from_file(path_to_compiled_packages) click to toggle source

Infers the metadata given a compiled packages file on disk @param path_to_compiled_packages [String] The path to the compiled packages file on disk @return [Vara::CompiledPackagesMetadata]

# File lib/vara/metadata/compiled_packages.rb, line 35
def self.from_file(path_to_compiled_packages)
  md5      = Digest::MD5.file(path_to_compiled_packages).hexdigest
  basename = File.basename(path_to_compiled_packages)

  name, rest = basename.split('-', 2)
  version    = rest.gsub(/-bosh.*$/, '')

  new(name, version, basename, md5)
end
new(name, version, file, md5, url = nil) click to toggle source

@param name [String] @param version [String] @param file [String] @param md5 [String] @param url [String]

# File lib/vara/metadata/compiled_packages.rb, line 50
def initialize(name, version, file, md5, url = nil)
  @name     = name
  @version  = version
  @basename = file
  @md5      = md5
  @url      = url
end

Public Instance Methods

aws() click to toggle source

@return [nil] the interface for downloader requires this method

# File lib/vara/metadata/compiled_packages.rb, line 66
def aws
  nil
end
to_s() click to toggle source

If the URL is set, a markdown-style URL with the basename attribute. Otherwise, just the basename. @return [String]

# File lib/vara/metadata/compiled_packages.rb, line 73
def to_s
  @url ? "[#{basename}](#{@url})" : basename
end
url() click to toggle source

The blobstore URL for the compiled_package. @raise [RuntimeError] if the URL is not set. @return [String]

# File lib/vara/metadata/compiled_packages.rb, line 61
def url
  @url || raise("URL unknown for compiled_packages #{name}")
end