Class: Kuby::Docker::Tags

Inherits:
Object
  • Object
show all
Defined in:
lib/kuby/docker/tags.rb

Constant Summary collapse

LATEST =
Metadata::LATEST_TAG

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#cliObject (readonly)

Returns the value of attribute cli.



6
7
8
# File 'lib/kuby/docker/tags.rb', line 6

def cli
  @cli
end

#metadataObject (readonly)

Returns the value of attribute metadata.



6
7
8
# File 'lib/kuby/docker/tags.rb', line 6

def 
  @metadata
end

#remote_clientObject (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

#allObject



44
45
46
# File 'lib/kuby/docker/tags.rb', line 44

def all
  self
end

#latest_tagsObject



18
19
20
# File 'lib/kuby/docker/tags.rb', line 18

def latest_tags
  (local.latest_tags + remote.latest_tags).uniq
end

#latest_timestamp_tagObject



40
41
42
# File 'lib/kuby/docker/tags.rb', line 40

def latest_timestamp_tag
  @latest_timestamp_tag ||= timestamp_tags.sort.last
end

#localObject



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 previous_timestamp_tag(current_tag)
  current_tag = ::Kuby::Docker::TimestampTag.try_parse(current_tag)
  all_tags = timestamp_tags.sort

  idx = all_tags.index do |tag|
    tag.time == current_tag.time
  end

  idx ||= 0
  return nil unless idx > 0

  all_tags[idx - 1]
end

#remoteObject



52
53
54
# File 'lib/kuby/docker/tags.rb', line 52

def remote
  @remote ||= RemoteTags.new(remote_client, )
end

#tagsObject



14
15
16
# File 'lib/kuby/docker/tags.rb', line 14

def tags
  (local.tags + remote.tags).uniq
end

#timestamp_tagsObject



36
37
38
# File 'lib/kuby/docker/tags.rb', line 36

def timestamp_tags
  (local.timestamp_tags + remote.timestamp_tags).uniq
end