class CFoundry::V2::AppInstance

Attributes

id[R]

Public Class Methods

for_app(name, guid, client) click to toggle source
# File lib/cfoundry/v2/app_instance.rb, line 5
def self.for_app(name, guid, client)
  client.base.instances(guid).collect do |i, m|
    AppInstance.new(name, guid, i.to_s, client, m)
  end
end
new(app_name, app_guid, id, client, manifest = {}) click to toggle source
# File lib/cfoundry/v2/app_instance.rb, line 11
def initialize(app_name, app_guid, id, client, manifest = {})
  @app_name = app_name
  @app_guid = app_guid
  @id = id
  @client = client
  @manifest = manifest
end

Public Instance Methods

console() click to toggle source
# File lib/cfoundry/v2/app_instance.rb, line 43
def console
  return unless @manifest[:console_ip] and @manifest[:console_port]

  {:ip => @manifest[:console_ip],
    :port => @manifest[:console_port]
  }
end
debugger() click to toggle source
# File lib/cfoundry/v2/app_instance.rb, line 35
def debugger
  return unless @manifest[:debug_ip] and @manifest[:debug_port]

  {:ip => @manifest[:debug_ip],
    :port => @manifest[:debug_port]
  }
end
file(*path) click to toggle source
# File lib/cfoundry/v2/app_instance.rb, line 66
def file(*path)
  @client.base.files(@app_guid, @id, *path)
end
files(*path) click to toggle source
# File lib/cfoundry/v2/app_instance.rb, line 60
def files(*path)
  @client.base.files(@app_guid, @id, *path).split("\n").collect do |entry|
    path + [entry.split(/\s+/, 2)[0]]
  end
end
healthy?() click to toggle source
# File lib/cfoundry/v2/app_instance.rb, line 51
def healthy?
  case state
  when "STARTING", "RUNNING"
    true
  when "DOWN", "FLAPPING"
    false
  end
end
inspect() click to toggle source
# File lib/cfoundry/v2/app_instance.rb, line 19
def inspect
  "#<App::Instance '#{@app_name}' \##@id>"
end
since() click to toggle source
# File lib/cfoundry/v2/app_instance.rb, line 29
def since
  if since = @manifest[:since]
    Time.at(@manifest[:since])
  end
end
state() click to toggle source
# File lib/cfoundry/v2/app_instance.rb, line 23
def state
  @manifest[:state]
end
Also aliased as: status
status()
Alias for: state
stream_file(*path, &blk) click to toggle source
# File lib/cfoundry/v2/app_instance.rb, line 70
def stream_file(*path, &blk)
  @client.base.stream_file(@app_guid, @id, *path, &blk)
end