class RakeDocker::Container::Destroyer

Attributes

name[R]
reporter[R]

Public Class Methods

new(name, opts = {}) click to toggle source
# File lib/rake_docker/container.rb, line 259
def initialize(name, opts = {})
  @name = name
  @reporter = opts[:reporter] || NullReporter.new
end

Public Instance Methods

execute() click to toggle source
# 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