Class: Avm::Docker::Image
- Inherits:
-
EacDocker::Images::Templatized
- Object
- EacDocker::Images::Templatized
- Avm::Docker::Image
show all
- Defined in:
- lib/avm/docker/image.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(registry) ⇒ Image
Returns a new instance of Image.
14
15
16
17
18
|
# File 'lib/avm/docker/image.rb', line 14
def initialize(registry)
@registry = registry
self.snapshot = true
self.version = true
end
|
Instance Attribute Details
#registry ⇒ Object
Returns the value of attribute registry.
10
11
12
|
# File 'lib/avm/docker/image.rb', line 10
def registry
@registry
end
|
#snapshot ⇒ Object
Returns the value of attribute snapshot.
11
12
13
|
# File 'lib/avm/docker/image.rb', line 11
def snapshot
@snapshot
end
|
#version ⇒ Object
Returns the value of attribute version.
12
13
14
|
# File 'lib/avm/docker/image.rb', line 12
def version
@version
end
|
Instance Method Details
#build(extra_args = []) ⇒ Object
20
21
22
23
24
|
# File 'lib/avm/docker/image.rb', line 20
def build( = [])
nyi "Extra args: #{}" if .any?
provide
end
|
#generator_version ⇒ Object
26
27
28
|
# File 'lib/avm/docker/image.rb', line 26
def generator_version
::Avm::VERSION
end
|
#push ⇒ Object
30
31
32
|
# File 'lib/avm/docker/image.rb', line 30
def push
::EacDocker::Executables.docker.command.append(['push', tag]).system!
end
|
#read_entry(path, options = {}) ⇒ Object
34
35
36
37
38
39
40
|
# File 'lib/avm/docker/image.rb', line 34
def read_entry(path, options = {})
method = path.gsub('.', '_')
return send(method) if respond_to?(path, true)
return instance.read_entry(path, options) if respond_to?(:instance)
raise "Method \"#{method}\" not found for entry \"#{path}\""
end
|
#run(instance) ⇒ Object
42
43
44
|
# File 'lib/avm/docker/image.rb', line 42
def run(instance)
run_run(instance) if container_exist?(instance)
end
|
#tag ⇒ Object
46
47
48
49
50
|
# File 'lib/avm/docker/image.rb', line 46
def tag
r = tag_name
r += ":#{tag_version}" if tag_version.present?
r
end
|
#tag_name ⇒ Object
52
53
54
55
56
|
# File 'lib/avm/docker/image.rb', line 52
def tag_name
return registry.name if registry.name.present?
raise 'Registry name is blank'
end
|
#tag_version ⇒ Object
58
59
60
|
# File 'lib/avm/docker/image.rb', line 58
def tag_version
[tag_version_version, stereotype_tag].reject(&:blank?).join('_')
end
|
#tag_version_version ⇒ Object
62
63
64
65
66
67
68
|
# File 'lib/avm/docker/image.rb', line 62
def tag_version_version
return nil unless version
r = generator_version
r += '-snapshot' if snapshot
r
end
|