class CF::Organization::Delete
Public Instance Methods
delete_org()
click to toggle source
# File lib/cf/cli/organization/delete.rb, line 16 def delete_org org = input[:organization] return unless input[:really, org] is_current = org == client.current_organization with_progress("Deleting organization #{c(org.name, :name)}") do org.delete!(:recursive => !!input[:recursive]) end orgs = client.organizations_first_page(:depth => 0) if orgs.empty? return unless input[:warn] line line c("There are no longer any organizations.", :warning) line "You may want to create one with #{c("create-org", :good)}." elsif is_current invalidate_client invoke :target end rescue CFoundry::AssociationNotEmpty => boom line line c(boom.description, :bad) line c("If you want to delete the organization along with all dependent objects, rerun the command with the #{b("'--recursive'")} flag.", :bad) exit_status(1) end
Private Instance Methods
ask_organization()
click to toggle source
# File lib/cf/cli/organization/delete.rb, line 45 def ask_organization @orgs = client.organizations(:depth => 0) fail "No organizations." if @orgs.empty? ask("Which organization", :choices => @orgs.sort_by(&:name), :display => proc(&:name)) end
ask_really(org)
click to toggle source
# File lib/cf/cli/organization/delete.rb, line 53 def ask_really(org) ask("Really delete #{c(org.name, :name)}?", :default => false) end
ask_recursive()
click to toggle source
# File lib/cf/cli/organization/delete.rb, line 57 def ask_recursive ask "Delete #{c("EVERYTHING", :bad)}?", :default => false end