Class: Kuby::Docker::Tags
- Inherits:
-
Object
- Object
- Kuby::Docker::Tags
- Defined in:
- lib/kuby/docker/tags.rb
Constant Summary collapse
- LATEST =
Metadata::LATEST_TAG
Instance Attribute Summary collapse
-
#cli ⇒ Object
readonly
Returns the value of attribute cli.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#remote_client ⇒ Object
readonly
Returns the value of attribute remote_client.
Instance Method Summary collapse
- #all ⇒ Object
-
#initialize(cli, remote_client, metadata) ⇒ Tags
constructor
A new instance of Tags.
- #latest_tags ⇒ Object
- #latest_timestamp_tag ⇒ Object
- #local ⇒ Object
- #previous_timestamp_tag(current_tag) ⇒ Object
- #remote ⇒ Object
- #tags ⇒ Object
- #timestamp_tags ⇒ Object
Constructor Details
#initialize(cli, remote_client, metadata) ⇒ Tags
Returns a new instance of Tags.
8 9 10 11 12 |
# File 'lib/kuby/docker/tags.rb', line 8 def initialize(cli, remote_client, ) @cli = cli @remote_client = remote_client @metadata = end |
Instance Attribute Details
#cli ⇒ Object (readonly)
Returns the value of attribute cli.
6 7 8 |
# File 'lib/kuby/docker/tags.rb', line 6 def cli @cli end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
6 7 8 |
# File 'lib/kuby/docker/tags.rb', line 6 def @metadata end |
#remote_client ⇒ Object (readonly)
Returns the value of attribute remote_client.
6 7 8 |
# File 'lib/kuby/docker/tags.rb', line 6 def remote_client @remote_client end |
Instance Method Details
#all ⇒ Object
44 45 46 |
# File 'lib/kuby/docker/tags.rb', line 44 def all self end |
#latest_tags ⇒ Object
18 19 20 |
# File 'lib/kuby/docker/tags.rb', line 18 def (local. + remote.).uniq end |
#latest_timestamp_tag ⇒ Object
40 41 42 |
# File 'lib/kuby/docker/tags.rb', line 40 def @latest_timestamp_tag ||= .sort.last end |
#local ⇒ Object
48 49 50 |
# File 'lib/kuby/docker/tags.rb', line 48 def local @local ||= LocalTags.new(cli, ) end |
#previous_timestamp_tag(current_tag) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/kuby/docker/tags.rb', line 22 def (current_tag) current_tag = ::Kuby::Docker::TimestampTag.try_parse(current_tag) = .sort idx = .index do |tag| tag.time == current_tag.time end idx ||= 0 return nil unless idx > 0 [idx - 1] end |
#remote ⇒ Object
52 53 54 |
# File 'lib/kuby/docker/tags.rb', line 52 def remote @remote ||= RemoteTags.new(remote_client, ) end |
#tags ⇒ Object
14 15 16 |
# File 'lib/kuby/docker/tags.rb', line 14 def (local. + remote.).uniq end |
#timestamp_tags ⇒ Object
36 37 38 |
# File 'lib/kuby/docker/tags.rb', line 36 def (local. + remote.).uniq end |