Class: CFoundry::V2::App::Instance
- Inherits:
-
Object
- Object
- CFoundry::V2::App::Instance
- Defined in:
- lib/cfoundry/v2/app.rb
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Instance Method Summary collapse
- #console ⇒ Object
- #debugger ⇒ Object
- #file(*path) ⇒ Object
- #files(*path) ⇒ Object
- #healthy? ⇒ Boolean
-
#initialize(app, id, client, manifest = {}) ⇒ Instance
constructor
A new instance of Instance.
- #inspect ⇒ Object
- #since ⇒ Object
- #state ⇒ Object (also: #status)
- #stream_file(*path, &blk) ⇒ Object
Constructor Details
#initialize(app, id, client, manifest = {}) ⇒ Instance
Returns a new instance of Instance.
294 295 296 297 298 299 |
# File 'lib/cfoundry/v2/app.rb', line 294 def initialize(app, id, client, manifest = {}) @app = app @id = id @client = client @manifest = manifest end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
292 293 294 |
# File 'lib/cfoundry/v2/app.rb', line 292 def app @app end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
292 293 294 |
# File 'lib/cfoundry/v2/app.rb', line 292 def id @id end |
Instance Method Details
#console ⇒ Object
324 325 326 327 328 329 330 |
# File 'lib/cfoundry/v2/app.rb', line 324 def console return unless @manifest[:console_ip] and @manifest[:console_port] { :ip => @manifest[:console_ip], :port => @manifest[:console_port] } end |
#debugger ⇒ Object
316 317 318 319 320 321 322 |
# File 'lib/cfoundry/v2/app.rb', line 316 def debugger return unless @manifest[:debug_ip] and @manifest[:debug_port] { :ip => @manifest[:debug_ip], :port => @manifest[:debug_port] } end |
#file(*path) ⇒ Object
347 348 349 |
# File 'lib/cfoundry/v2/app.rb', line 347 def file(*path) @client.base.files(@app.guid, @id, *path) end |
#files(*path) ⇒ Object
341 342 343 344 345 |
# File 'lib/cfoundry/v2/app.rb', line 341 def files(*path) @client.base.files(@app.guid, @id, *path).split("\n").collect do |entry| path + [entry.split(/\s+/, 2)[0]] end end |
#healthy? ⇒ Boolean
332 333 334 335 336 337 338 339 |
# File 'lib/cfoundry/v2/app.rb', line 332 def healthy? case state when "STARTING", "RUNNING" true when "DOWN", "FLAPPING" false end end |
#inspect ⇒ Object
301 302 303 |
# File 'lib/cfoundry/v2/app.rb', line 301 def inspect "#<App::Instance '#{@app.name}' \##@id>" end |
#since ⇒ Object
310 311 312 313 314 |
# File 'lib/cfoundry/v2/app.rb', line 310 def since if since = @manifest[:since] Time.at(@manifest[:since]) end end |
#state ⇒ Object Also known as: status
305 306 307 |
# File 'lib/cfoundry/v2/app.rb', line 305 def state @manifest[:state] end |
#stream_file(*path, &blk) ⇒ Object
351 352 353 |
# File 'lib/cfoundry/v2/app.rb', line 351 def stream_file(*path, &blk) @client.base.stream_file(@app.guid, @id, *path, &blk) end |