Class: Holodekk::Image::Instructions::Copy

Inherits:
Builder::Instruction show all
Defined in:
lib/holodekk/image/instructions/copy.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Builder::Instruction

#as_json, instruction_tag, tag, #tag, #to_json

Instance Attribute Details

#chownObject

Returns the value of attribute chown.



7
8
9
# File 'lib/holodekk/image/instructions/copy.rb', line 7

def chown
  @chown
end

#fromObject

Returns the value of attribute from.



7
8
9
# File 'lib/holodekk/image/instructions/copy.rb', line 7

def from
  @from
end

Returns the value of attribute link.



7
8
9
# File 'lib/holodekk/image/instructions/copy.rb', line 7

def link
  @link
end

#sourcesObject

Returns the value of attribute sources.



7
8
9
# File 'lib/holodekk/image/instructions/copy.rb', line 7

def sources
  @sources
end

#targetObject

Returns the value of attribute target.



7
8
9
# File 'lib/holodekk/image/instructions/copy.rb', line 7

def target
  @target
end

Class Method Details

.build(sources, target, **kwargs) ⇒ Object



16
17
18
19
# File 'lib/holodekk/image/instructions/copy.rb', line 16

def self.build(sources, target, **kwargs)
  s = *sources
  new({ sources: s, target: target }.merge(kwargs))
end

Instance Method Details

#to_dockerfileObject



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/holodekk/image/instructions/copy.rb', line 21

def to_dockerfile
  builder = Docker::Dockerfile::InstructionBuilder.new(self)
  builder.flag('link', link)
  add_option(builder, 'chown')
  add_option(builder, 'from')
  builder.value_list(*sources.map do |s|
    Docker::Dockerfile::InstructionBuilder::QuotedString.new(s)
  end)
  builder.quoted_string(target)
  builder.output
end