Sha256: 2a755b66fb3e90851fcd14238283fbc4a44d9abe02741d3f8a0c475d1571f9da

Contents?: true

Size: 753 Bytes

Versions: 9

Compression:

Stored size: 753 Bytes

Contents

require 'util'
require 'fileutils'

class Delete < Thor
  include Thor::Actions
  include DockerMgr::Util

  desc 'app APP_NAME','deletes an app'
  def app(app_name)
    @app_name = app_name
    abort "#{@app_name} is not a valid app" unless Dir.exist? "#{apps_dir}/#{@app_name}"
    choice = ask "do you want to remove #{@app_name}? (y,N)"
    abort "aborting" unless choice == 'y'
    FileUtils.cd "#{apps_dir}/#{@app_name}" do
      puts `echo y | sudo docker-compose rm` 
    end
    puts `tar -zcf #{attic_dir}/#{@app_name}.tar -C #{apps_dir} #{@app_name}`
    FileUtils.rm_rf "#{apps_dir}/#{@app_name}"
    FileUtils.rm_rf "#{backup_dir}/#{@app_name}"
    remove_line_from_routine("backup_routine","docker_mgr backup_app #{@app_name}")
  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
dockersitter-0.7.0 lib/commands/delete.rb
dockersitter-0.6.0 lib/commands/delete.rb
dockersitter-0.5.0 lib/commands/delete.rb
dockersitter-0.4.0 lib/commands/delete.rb
dockersitter-0.3.0 lib/commands/delete.rb
dockersitter-0.2.2 lib/commands/delete.rb
dockersitter-0.2.1 lib/commands/delete.rb
dockersitter-0.2.0 lib/commands/delete.rb
dockersitter-0.1.0 lib/commands/delete.rb