Class: Kuby::Docker::CopyPhase

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

Constant Summary collapse

DEFAULT_PATHS =
['./'].freeze

Instance Attribute Summary collapse

Attributes inherited from Phase

#definition

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ CopyPhase

Returns a new instance of CopyPhase.



8
9
10
11
# File 'lib/kuby/docker/copy_phase.rb', line 8

def initialize(*args)
  super
  @paths = []
end

Instance Attribute Details

#pathsObject (readonly)

Returns the value of attribute paths.



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

def paths
  @paths
end

Instance Method Details

#<<(path) ⇒ Object



13
14
15
# File 'lib/kuby/docker/copy_phase.rb', line 13

def <<(path)
  paths << path
end

#apply_to(dockerfile) ⇒ Object



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

def apply_to(dockerfile)
  to_copy = paths.empty? ? DEFAULT_PATHS : paths
  to_copy.each { |path| dockerfile.copy(path, '.') }
end