Class: Dockerun::Cli::DeleteContainer
- Inherits:
-
Object
- Object
- Dockerun::Cli::DeleteContainer
- Defined in:
- lib/dockerun/cli/delete_container.rb
Instance Method Summary collapse
- #cf ⇒ Object
- #delete_container ⇒ Object
-
#initialize ⇒ DeleteContainer
constructor
A new instance of DeleteContainer.
- #pmt ⇒ Object
- #start(root) ⇒ Object
Constructor Details
#initialize ⇒ DeleteContainer
Returns a new instance of DeleteContainer.
12 13 14 |
# File 'lib/dockerun/cli/delete_container.rb', line 12 def initialize @proxy = DSLProxy.new end |
Instance Method Details
#cf ⇒ Object
50 51 52 53 54 55 |
# File 'lib/dockerun/cli/delete_container.rb', line 50 def cf if @_cf.nil? @_cf = CommandFactory.new end @_cf end |
#delete_container ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/dockerun/cli/delete_container.rb', line 26 def delete_container selSpec = CliEngine.select_spec(@proxy.exec_root) cont = File.read(selSpec) @proxy.set_dry_run_mode @proxy.instance_eval(cont) skip = pmt.no?(" Delete container named '#{@proxy.container_name}'?") if not skip cf.stop_container(@proxy.container_name).run res = cf.delete_container(@proxy.container_name).run if res.success? pmt.puts " Container '#{@proxy.container_name}' deleted".green else pmt.puts " Container '#{@proxy.container_name}' deletion failed. Error was : #{res.err_lines.join("\n")}".red end else pmt.puts " Container deletion of name '#{@proxy.container_name}' aborted.".yellow end end |
#pmt ⇒ Object
46 47 48 |
# File 'lib/dockerun/cli/delete_container.rb', line 46 def pmt CliEngine.pmt end |
#start(root) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/dockerun/cli/delete_container.rb', line 16 def start(root) @proxy.set_exec_root(root) begin pmt.puts " Dockerun version #{Dockerun::VERSION}".yellow pmt.puts " Operational : Delete Container" delete_container rescue TTY::Reader::InputInterrupt end end |