Class: Kuby::Docker::CopyPhase

Inherits:
Layer
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/kuby/docker/copy_phase.rb

Constant Summary collapse

DEFAULT_PATHS =
T.let(['./'].freeze, T::Array[String])

Instance Attribute Summary collapse

Attributes inherited from Layer

#environment

Instance Method Summary collapse

Constructor Details

#initialize(environment) ⇒ CopyPhase

Returns a new instance of CopyPhase.



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

def initialize(environment)
  super
  @paths = T.let([], T::Array[String])
end

Instance Attribute Details

#pathsObject (readonly)

Returns the value of attribute paths.



11
12
13
# File 'lib/kuby/docker/copy_phase.rb', line 11

def paths
  @paths
end

Instance Method Details

#<<(path) ⇒ Object



20
21
22
# File 'lib/kuby/docker/copy_phase.rb', line 20

def <<(path)
  paths << path
end

#apply_to(dockerfile) ⇒ Object



25
26
27
28
# File 'lib/kuby/docker/copy_phase.rb', line 25

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