lib/percheron/container/actions/stop.rb in percheron-0.4.0 vs lib/percheron/container/actions/stop.rb in percheron-0.5.0

- old
+ new

@@ -1,26 +1,32 @@ module Percheron module Container module Actions class Stop + include Base + def initialize(container) @container = container end def execute! - if container.running? - $logger.debug "Stopping '#{container.name}'" - container.docker_container.stop! - else - $logger.debug "Not stopping '#{container.name}' container as it's not running" - raise Errors::ContainerNotRunning.new - end + stop! end private attr_reader :container + + def stop! + if container.running? + $logger.debug "Stopping '#{container.name}'" + container.docker_container.stop! + else + $logger.debug "Not stopping '#{container.name}' container as it's not running" + raise Errors::ContainerNotRunning.new + end + end end end end end