Class: Kuby::Docker::Metadata
- Inherits:
-
Object
- Object
- Kuby::Docker::Metadata
- Defined in:
- lib/kuby/docker/metadata.rb
Constant Summary collapse
- DEFAULT_DISTRO =
:debian
- DEFAULT_REGISTRY_HOST =
'https://docker.io'.freeze
- LATEST_TAG =
'latest'
Instance Attribute Summary collapse
-
#definition ⇒ Object
readonly
Returns the value of attribute definition.
-
#distro ⇒ Object
Returns the value of attribute distro.
-
#image_url ⇒ Object
Returns the value of attribute image_url.
Instance Method Summary collapse
- #image_host ⇒ Object
- #image_repo ⇒ Object
-
#initialize(definition) ⇒ Metadata
constructor
A new instance of Metadata.
- #tags ⇒ Object
Constructor Details
#initialize(definition) ⇒ Metadata
Returns a new instance of Metadata.
13 14 15 16 |
# File 'lib/kuby/docker/metadata.rb', line 13 def initialize(definition) @definition = definition @tags = [] end |
Instance Attribute Details
#definition ⇒ Object (readonly)
Returns the value of attribute definition.
11 12 13 |
# File 'lib/kuby/docker/metadata.rb', line 11 def definition @definition end |
#distro ⇒ Object
Returns the value of attribute distro.
11 12 13 |
# File 'lib/kuby/docker/metadata.rb', line 11 def distro @distro end |
#image_url ⇒ Object
Returns the value of attribute image_url.
10 11 12 |
# File 'lib/kuby/docker/metadata.rb', line 10 def image_url @image_url end |
Instance Method Details
#image_host ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/kuby/docker/metadata.rb', line 22 def image_host @image_host ||= if image_url.include?('/') uri = parse_url(image_url) "#{uri.scheme}://#{uri.host}" else DEFAULT_REGISTRY_HOST end end |
#image_repo ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/kuby/docker/metadata.rb', line 31 def image_repo @image_repo ||= if image_url.include?('/') parse_url(image_url).path.sub(/\A\//, '') else image_url end end |
#tags ⇒ Object
39 40 41 |
# File 'lib/kuby/docker/metadata.rb', line 39 def @tags.empty? ? : @tags end |