class CF::Space::Delete

Public Instance Methods

delete_space() click to toggle source
# File lib/cf/cli/space/delete.rb, line 19
def delete_space
  space = input[:space, org]

  return unless input[:really, space]

  deleting_current_space = (space == client.current_space)

  with_progress("Deleting space #{c(space.name, :name)}") do
    if input[:recursive]
      space.delete!(:recursive => true)
    else
      space.delete!
    end
  end

  if deleting_current_space
    line
    line c("The space that you were targeting has now been deleted. Please use #{b("`cf target -s SPACE_NAME`")} to target a different one.", :warning)
  end
rescue CFoundry::AssociationNotEmpty => boom
  line
  line c(boom.description, :bad)
  line c("If you want to delete the space along with all dependent objects, rerun the command with the #{b("'--recursive'")} flag.", :bad)
  exit_status(1)
end

Private Instance Methods

ask_really(space) click to toggle source
# File lib/cf/cli/space/delete.rb, line 47
def ask_really(space)
  ask("Really delete #{c(space.name, :name)}?", :default => false)
end
ask_recursive() click to toggle source
# File lib/cf/cli/space/delete.rb, line 51
def ask_recursive
  ask "Delete #{c("EVERYTHING", :bad)}?", :default => false
end