Class: OsCtl::Repo::Remote::Image
Instance Attribute Summary
Attributes inherited from Base::Image
#arch, #distribution, #image, #repo, #tags, #variant, #vendor, #version
Instance Method Summary
collapse
Methods inherited from Base::Image
#<=>, #==, #abs_dir_path, #abs_image_path, #abs_tag_path, #dir_path, #has_image?, #image_name, #image_path, #initialize, load, #to_s, #version_image_path
Instance Method Details
#abs_cache_path(format) ⇒ Object
10
11
12
|
# File 'lib/osctl/repo/remote/template.rb', line 10
def abs_cache_path(format)
abs_image_path(format)
end
|
#abs_image_url(format) ⇒ Object
6
7
8
|
# File 'lib/osctl/repo/remote/template.rb', line 6
def abs_image_url(format)
File.join(repo.url, image_path(format))
end
|
#cached?(format) ⇒ Boolean
14
15
16
|
# File 'lib/osctl/repo/remote/template.rb', line 14
def cached?(format)
File.exist?(abs_cache_path(format))
end
|
#dump ⇒ Object
25
26
27
28
29
30
31
|
# File 'lib/osctl/repo/remote/template.rb', line 25
def dump
ret = super
ret[:cached] = ret[:image].select do |format, _path|
cached?(format)
end.map { |format, _path| format }
ret
end
|
#lock(format) ⇒ Object
18
19
20
21
22
23
|
# File 'lib/osctl/repo/remote/template.rb', line 18
def lock(format, &)
Filelock(
File.join(abs_dir_path, ".#{image_name(format)}.lock"),
timeout: 60 * 60, &
)
end
|