Class: Avm::Docker::Image
Constant Summary
collapse
- DEFAULT_REGISTRY_NAME =
'local'
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
#variables_source
Constructor Details
#initialize(registry = nil) ⇒ Image
Returns a new instance of Image.
26
27
28
29
30
31
|
# File 'lib/avm/docker/image.rb', line 26
def initialize(registry = nil)
super()
@registry = registry || self.class.default_registry
self.snapshot = true
self.version = true
end
|
Instance Attribute Details
#registry ⇒ Object
Returns the value of attribute registry.
23
24
25
|
# File 'lib/avm/docker/image.rb', line 23
def registry
@registry
end
|
#snapshot ⇒ Object
Returns the value of attribute snapshot.
24
25
26
|
# File 'lib/avm/docker/image.rb', line 24
def snapshot
@snapshot
end
|
#version ⇒ Object
Returns the value of attribute version.
24
25
26
|
# File 'lib/avm/docker/image.rb', line 24
def version
@version
end
|
Class Method Details
.default_registry ⇒ EacDocker::Registry
18
19
20
|
# File 'lib/avm/docker/image.rb', line 18
def default_registry
::EacDocker::Registry.new(DEFAULT_REGISTRY_NAME)
end
|
Instance Method Details
#build(extra_args = []) ⇒ Object
33
34
35
36
37
|
# File 'lib/avm/docker/image.rb', line 33
def build( = [])
nyi "Extra args: #{}" if .any?
provide
end
|
#generator_version ⇒ Object
39
40
41
|
# File 'lib/avm/docker/image.rb', line 39
def generator_version
::Avm::VERSION
end
|
#push ⇒ Object
43
44
45
|
# File 'lib/avm/docker/image.rb', line 43
def push
::EacDocker::Executables.docker.command.append(['push', tag]).system!
end
|
#run(instance) ⇒ Object
47
48
49
|
# File 'lib/avm/docker/image.rb', line 47
def run(instance)
run_run(instance) if container_exist?(instance)
end
|
#tag ⇒ Object
51
52
53
54
55
|
# File 'lib/avm/docker/image.rb', line 51
def tag
r = tag_name
r += ":#{tag_version}" if tag_version.present?
r
end
|
#tag_name ⇒ Object
57
58
59
60
61
|
# File 'lib/avm/docker/image.rb', line 57
def tag_name
return registry.name if registry.name.present?
raise 'Registry name is blank'
end
|
#tag_version ⇒ Object
63
64
65
|
# File 'lib/avm/docker/image.rb', line 63
def tag_version
[tag_version_version, stereotype_tag].compact_blank.join('_')
end
|
#tag_version_version ⇒ Object
67
68
69
70
71
72
73
|
# File 'lib/avm/docker/image.rb', line 67
def tag_version_version
return nil unless version
r = generator_version
r += '-snapshot' if snapshot
r
end
|