Class: Kuby::Docker::CopyPhase

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

Constant Summary collapse

DEFAULT_PATHS =

extend T::Sig

['./'].freeze

Instance Attribute Summary collapse

Attributes inherited from Layer

#environment

Instance Method Summary collapse

Constructor Details

#initialize(environment) ⇒ CopyPhase

T::Sig::WithoutRuntime.sig { params(environment: Environment).void }



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

def initialize(environment)
  super
  @paths = []
end

Instance Attribute Details

#pathsObject (readonly)

T::Sig::WithoutRuntime.sig { returns(T::Array) }



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

def paths
  @paths
end

Instance Method Details

#<<(path) ⇒ Object

T::Sig::WithoutRuntime.sig { params(path: String).void }



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

def <<(path)
  paths << path
end

#apply_to(dockerfile) ⇒ Object

T::Sig::WithoutRuntime.sig { params(dockerfile: Dockerfile).void }



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