Class: Indocker::ImageMetadata

Inherits:
Object
  • Object
show all
Defined in:
lib/indocker/image/image_metadata.rb

Constant Summary collapse

DEFAULT_TAG =
'latest'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(repo:, tag:, directives:, build_dir:) ⇒ ImageMetadata

Returns a new instance of ImageMetadata.



6
7
8
9
10
11
# File 'lib/indocker/image/image_metadata.rb', line 6

def initialize(repo:, tag:, directives:, build_dir:)
  @repo       = repo
  @tag        = tag
  @directives = directives
  @build_dir  = build_dir
end

Instance Attribute Details

#build_dir ⇒ Object (readonly)

Returns the value of attribute build_dir.



4
5
6
# File 'lib/indocker/image/image_metadata.rb', line 4

def build_dir
  @build_dir
end

#directives ⇒ Object (readonly)

Returns the value of attribute directives.



4
5
6
# File 'lib/indocker/image/image_metadata.rb', line 4

def directives
  @directives
end

#repo ⇒ Object (readonly)

Returns the value of attribute repo.



4
5
6
# File 'lib/indocker/image/image_metadata.rb', line 4

def repo
  @repo
end

#tag ⇒ Object (readonly)

Returns the value of attribute tag.



4
5
6
# File 'lib/indocker/image/image_metadata.rb', line 4

def tag
  @tag
end

Instance Method Details

#build_directives ⇒ Object



25
26
27
# File 'lib/indocker/image/image_metadata.rb', line 25

def build_directives
  directives.select {|d| d.build_directive?}
end

#docker_cp_directives ⇒ Object



29
30
31
# File 'lib/indocker/image/image_metadata.rb', line 29

def docker_cp_directives
  directives.select {|d| d.is_a?(Indocker::PrepareDirectives::DockerCp)}
end

#dockerhub_image? ⇒ Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/indocker/image/image_metadata.rb', line 41

def dockerhub_image?
  from_directive.dockerhub_image?
end

#from_repo ⇒ Object



33
34
35
# File 'lib/indocker/image/image_metadata.rb', line 33

def from_repo
  from_directive.repo
end

#from_tag ⇒ Object



37
38
39
# File 'lib/indocker/image/image_metadata.rb', line 37

def from_tag
  from_directive.tag
end

#full_name ⇒ Object



13
14
15
# File 'lib/indocker/image/image_metadata.rb', line 13

def full_name
  "#{repo}:#{tag}"
end

#full_name_with_registry ⇒ Object



17
18
19
# File 'lib/indocker/image/image_metadata.rb', line 17

def full_name_with_registry
  "#{Indocker.config.registry}/#{local_full_name}"
end

#prepare_directives ⇒ Object



21
22
23
# File 'lib/indocker/image/image_metadata.rb', line 21

def prepare_directives
  directives.select {|d| d.prepare_directive?}
end