class CF::App::Apps
Constants
- IS_UTF8
Public Instance Methods
app()
click to toggle source
# File lib/cf/cli/app/app.rb, line 11 def app app = input[:app] if quiet? line app.name else display_app(app) end end
app_matches?(a, options)
click to toggle source
# File lib/cf/cli/app/apps.rb, line 75 def app_matches?(a, options) if name = options[:name] return false if a.name !~ /#{name}/ end if url = options[:url] return false if a.urls.none? { |u| u =~ /#{url}/ } end true end
apps()
click to toggle source
# File lib/cf/cli/app/apps.rb, line 13 def apps if space = input[:space] begin space.summarize! rescue CFoundry::APIError end apps = with_progress("Getting applications in #{c(space.name, :name)}") do space.apps end else apps = with_progress("Getting applications") do client.apps(:depth => 2) end end line unless quiet? if apps.empty? and !quiet? line "No applications." return end apps.reject! do |a| !app_matches?(a, input) end apps = apps.sort_by(&:name) if input[:full] spaced(apps) do |a| invoke :app, :app => a end elsif quiet? apps.each do |a| line a.name end else display_apps_table(apps) end end
display_app(a)
click to toggle source
# File lib/cf/cli/app/app.rb, line 21 def display_app(a) status = app_status(a) line "#{c(a.name, :name)}: #{status}" indented do start_line "usage: #{b(human_mb(a.memory))}" print " #{d(IS_UTF8 ? "\xc3\x97" : "x")} #{b(a.total_instances)}" print " instance#{a.total_instances == 1 ? "" : "s"}" line unless a.urls.empty? line "urls: #{a.urls.collect { |u| b(u) }.join(", ")}" end unless a.services.empty? line "services: #{a.services.collect { |s| b(s.name) }.join(", ")}" end end end
display_apps_table(apps)
click to toggle source
# File lib/cf/cli/app/apps.rb, line 57 def display_apps_table(apps) table( ["name", "status", "usage", "url"], apps.collect { |a| [ c(a.name, :name), app_status(a), "#{a.total_instances} x #{human_mb(a.memory)}", if a.urls.empty? d("none") elsif a.urls.size == 1 a.url else "#{a.url}, ..." end ] }) end