class CF::Route::Unmap

Public Instance Methods

unmap() click to toggle source
# File lib/cf/cli/route/unmap.rb, line 15
def unmap
  if input[:all]
    if input.has?(:app)
      app = target = input[:app]
    else
      target = client
    end

    target.routes.each do |r|
      begin
        invoke :unmap, :url => r, :really => true, :app => app
      rescue CFoundry::APIError => e
        err "#{e.class}: #{e.message}"
      end
    end

    return
  end

  app = input[:app]
  url = input[:url, app ? app.routes : client.routes]

  if app
    with_progress("Unbinding #{c(url.name, :name)} from #{c(app.name, :name)}") do
      app.remove_route(url)
    end
  else
    fail "Missing --app."
  end
end

Private Instance Methods

ask_really(name, color) click to toggle source
# File lib/cf/cli/route/unmap.rb, line 52
def ask_really(name, color)
  ask("Really delete #{c(name, color)}?", :default => false)
end
ask_url(choices) click to toggle source
# File lib/cf/cli/route/unmap.rb, line 48
def ask_url(choices)
  ask("Which URL?", :choices => choices.sort_by(&:name), :display => proc(&:name))
end