class Vara::ProductContents

Attributes

metadata_path[R]
product_metadata[R]

Public Class Methods

from_metadata_path(metadata_path) click to toggle source

@param metadata_path [String] The path on disk to the metadata YAML file @return [Vara::ProductContents]

# File lib/vara/product_contents.rb, line 7
def self.from_metadata_path(metadata_path)
  new(metadata_path, ProductMetadata.from_file(metadata_path))
end
new(metadata_path, product_metadata) click to toggle source

@param metadata_path [String] The path on disk to the metadata YAML file @param product_metadata [Vara::ProductMetadata] The Product Metadata as represented in the metadata_path file

# File lib/vara/product_contents.rb, line 15
def initialize(metadata_path, product_metadata)
  @metadata_path    = File.expand_path(metadata_path).freeze
  @product_metadata = product_metadata
end

Public Instance Methods

compiled_packages_path() click to toggle source

@return [String] The path to the compiled packages file on disk

# File lib/vara/product_contents.rb, line 50
def compiled_packages_path
  File.join(root_path, 'compiled_packages', product_metadata.compiled_packages_file)
end
content_migrations_exist?() click to toggle source
# File lib/vara/product_contents.rb, line 27
def content_migrations_exist?
  File.exist?(File.expand_path(File.join(root_path, 'content_migrations')))
end
content_migrations_path() click to toggle source

@return [String] The path to the content migration file on disk

# File lib/vara/product_contents.rb, line 21
def content_migrations_path
  paths = Dir.glob(File.expand_path(File.join(root_path, 'content_migrations', '*.yml')))
  raise "Exactly one content_migrations file is required in #{root_path}/content_migrations" if paths.size != 1
  paths.first
end
has_compiled_packages?() click to toggle source

@return [Boolean] Whether the product metadata has a compiled packages field

# File lib/vara/product_contents.rb, line 55
def has_compiled_packages?
  product_metadata.has_compiled_packages?
end
migrations_exist?() click to toggle source
# File lib/vara/product_contents.rb, line 35
def migrations_exist?
  File.exist?(File.expand_path(File.join(root_path, 'migrations')))
end
migrations_path() click to toggle source
# File lib/vara/product_contents.rb, line 31
def migrations_path
  File.expand_path(File.join(root_path, 'migrations'))
end
release_paths() click to toggle source

@return [<String>] The paths to the release tarballs on disk

# File lib/vara/product_contents.rb, line 40
def release_paths
  product_metadata.releases_metadata.map { |release_metadata| File.join(root_path, 'releases', release_metadata.basename) }
end
stemcell_path() click to toggle source

@return [String] The path to the stemcell file on disk

# File lib/vara/product_contents.rb, line 45
def stemcell_path
  File.join(root_path, 'stemcells', product_metadata.stemcell_file)
end

Private Instance Methods

root_path() click to toggle source
# File lib/vara/product_contents.rb, line 61
def root_path
  File.expand_path(File.join(metadata_path, '..', '..'))
end