Class: RakeDocker::Container::Destroyer
- Inherits:
-
Object
- Object
- RakeDocker::Container::Destroyer
- Includes:
- Utilities
- Defined in:
- lib/rake_docker/container.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#reporter ⇒ Object
readonly
Returns the value of attribute reporter.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(name, opts = {}) ⇒ Destroyer
constructor
A new instance of Destroyer.
Methods included from Utilities
#enhance_with_name, #find_container
Constructor Details
#initialize(name, opts = {}) ⇒ Destroyer
Returns a new instance of Destroyer.
259 260 261 262 |
# File 'lib/rake_docker/container.rb', line 259 def initialize(name, opts = {}) @name = name @reporter = opts[:reporter] || NullReporter.new end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
257 258 259 |
# File 'lib/rake_docker/container.rb', line 257 def name @name end |
#reporter ⇒ Object (readonly)
Returns the value of attribute reporter.
257 258 259 |
# File 'lib/rake_docker/container.rb', line 257 def reporter @reporter end |
Instance Method Details
#execute ⇒ Object
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 |
# File 'lib/rake_docker/container.rb', line 264 def execute reporter.checking_if_container_exists(name) container = find_container(name) if container reporter.container_exists(container) reporter.stopping_container(container) container.stop container.wait reporter.container_stopped(container) reporter.deleting_container(container) container.delete reporter.container_deleted(container) else reporter.container_does_not_exist(name) end reporter.done end |