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
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 |
# File 'lib/drydock/phase.rb', line 14 def self.from(hsh) h = hsh.to_h extra_keys = h.keys - members raise ArgumentError, "unknown options: #{extra_keys.join(', ')}" unless extra_keys.empty? new(*h.values_at(*members)) end |
Instance Method Details
#built? ⇒ Boolean
21 22 23 |
# File 'lib/drydock/phase.rb', line 21 def built? !cached? end |
#cached? ⇒ Boolean
25 26 27 |
# File 'lib/drydock/phase.rb', line 25 def cached? build_container.nil? end |
#destroy!(force: false) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/drydock/phase.rb', line 29 def destroy!(force: false) 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 build_container.remove(force: force) if built? self end |
#finalize!(force: false) ⇒ Object
43 44 45 46 47 |
# File 'lib/drydock/phase.rb', line 43 def finalize!(force: false) return self unless built? build_container.remove(force: force) self end |