Class: Drydock::Phase
- Inherits:
-
Struct
- Object
- Struct
- Drydock::Phase
- Defined in:
- lib/drydock/phase.rb
Instance Attribute Summary collapse
-
#build_container ⇒ Object
(also: #build)
Returns the value of attribute build_container.
-
#result_image ⇒ Object
(also: #result)
Returns the value of attribute result_image.
-
#source_image ⇒ Object
(also: #source)
Returns the value of attribute source_image.
Class Method Summary collapse
Instance Method Summary collapse
- #built? ⇒ Boolean
- #cached? ⇒ Boolean
- #destroy!(force: false) ⇒ Object
- #finalize!(force: false) ⇒ Object
- #finalized? ⇒ Boolean
-
#initialize(*args) ⇒ Phase
constructor
A new instance of Phase.
Constructor Details
#initialize(*args) ⇒ Phase
Returns a new instance of Phase.
23 24 25 26 |
# File 'lib/drydock/phase.rb', line 23 def initialize(*args) super @finalized = false end |
Instance Attribute Details
#build_container ⇒ Object Also known as: build
Returns the value of attribute build_container
3 4 5 |
# File 'lib/drydock/phase.rb', line 3 def build_container @build_container end |
#result_image ⇒ Object Also known as: result
Returns the value of attribute result_image
3 4 5 |
# File 'lib/drydock/phase.rb', line 3 def result_image @result_image end |
#source_image ⇒ Object Also known as: source
Returns the value of attribute source_image
3 4 5 |
# File 'lib/drydock/phase.rb', line 3 def source_image @source_image end |
Class Method Details
.from(hsh) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/drydock/phase.rb', line 14 def self.from(hsh) h = hsh.to_h extra_keys = h.keys - members fail ArgumentError, "unknown options: #{extra_keys.join(', ')}" unless extra_keys.empty? new(*h.values_at(*members)) end |
Instance Method Details
#built? ⇒ Boolean
28 29 30 |
# File 'lib/drydock/phase.rb', line 28 def built? !cached? end |
#cached? ⇒ Boolean
32 33 34 |
# File 'lib/drydock/phase.rb', line 32 def cached? build_container.nil? end |
#destroy!(force: false) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/drydock/phase.rb', line 36 def destroy!(force: false) return self if frozen? finalize!(force: force) if result_image begin result_image.remove(force: force) rescue Docker::Error::NotFoundError => e # Ignore, because the image could have been deleted by another phase in # another derived chain. end end freeze end |
#finalize!(force: false) ⇒ Object
53 54 55 56 57 58 59 60 |
# File 'lib/drydock/phase.rb', line 53 def finalize!(force: false) unless finalized? build_container.remove(force: force) if built? @finalized = true end self end |
#finalized? ⇒ Boolean
62 63 64 |
# File 'lib/drydock/phase.rb', line 62 def finalized? @finalized end |