Sha256: bb494604dbe8f0f03360b6beea824512e3df86882189d3c8ea7d0f5ec08a9e43
Contents?: true
Size: 1.22 KB
Versions: 72
Compression:
Stored size: 1.22 KB
Contents
class KuberKit::Core::ImageStore include KuberKit::Import[ "core.image_factory", "core.image_definition_factory", "shell.local_shell", "ui" ] def define(image_name, image_dir = nil) definition = image_definition_factory.create(image_name, image_dir) add_definition(definition) definition end def add_definition(image_definition) definitions_store.add(image_definition.image_name, image_definition) end Contract Symbol => Any def get_definition(image_name) definitions_store.get(image_name) end Contract Symbol => Any def get_image(image_name) definition = get_definition(image_name) image_factory.create(definition) end def load_definitions(dir_path) files = local_shell.recursive_list_files(dir_path, name: "image.rb").each do |path| load_definition(path) end rescue KuberKit::Shell::AbstractShell::DirNotFoundError ui.print_warning("ImageStore", "Directory with images not found: #{dir_path}") [] end def load_definition(file_path) require(file_path) end def reset! definitions_store.reset! end private def definitions_store @@definitions_store ||= KuberKit::Core::Store.new(KuberKit::Core::ImageDefinition) end end
Version data entries
72 entries across 72 versions & 1 rubygems