cfoundry 0.3.28 → 0.3.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/cfoundry/v1/app.rb +11 -62
- data/lib/cfoundry/v2/app.rb +12 -2
- data/lib/cfoundry/v2/base.rb +8 -0
- data/lib/cfoundry/version.rb +1 -1
- metadata +4 -4
data/lib/cfoundry/v1/app.rb
CHANGED
@@ -107,14 +107,14 @@ module CFoundry::V1
|
|
107
107
|
# Retrieve all of the instances of the app, as Instance objects.
|
108
108
|
def instances
|
109
109
|
@client.base.instances(@name).collect do |m|
|
110
|
-
Instance.new(
|
110
|
+
Instance.new(self, m[:index].to_s, @client, m)
|
111
111
|
end
|
112
112
|
end
|
113
113
|
|
114
114
|
# Retrieve crashed instances
|
115
115
|
def crashes
|
116
116
|
@client.base.crashes(@name).collect do |i|
|
117
|
-
|
117
|
+
Instance.new(self, i[:instance].to_s, @client, i)
|
118
118
|
end
|
119
119
|
end
|
120
120
|
|
@@ -323,7 +323,7 @@ module CFoundry::V1
|
|
323
323
|
#
|
324
324
|
# For example, <code>files("foo", "bar")</code> for +foo/bar+.
|
325
325
|
def files(*path)
|
326
|
-
Instance.new(@name, 0, @client).files(*path)
|
326
|
+
Instance.new(@name, "0", @client).files(*path)
|
327
327
|
end
|
328
328
|
|
329
329
|
# Retrieve file contents for the first instance of the application.
|
@@ -333,7 +333,7 @@ module CFoundry::V1
|
|
333
333
|
#
|
334
334
|
# For example, <code>files("foo", "bar")</code> for +foo/bar+.
|
335
335
|
def file(*path)
|
336
|
-
Instance.new(@name, 0, @client).file(*path)
|
336
|
+
Instance.new(@name, "0", @client).file(*path)
|
337
337
|
end
|
338
338
|
|
339
339
|
# Upload application's code to target. Do this after #create! and before
|
@@ -477,21 +477,21 @@ module CFoundry::V1
|
|
477
477
|
attr_reader :app
|
478
478
|
|
479
479
|
# Application instance number.
|
480
|
-
attr_reader :
|
480
|
+
attr_reader :id
|
481
481
|
|
482
482
|
# Create an Instance object.
|
483
483
|
#
|
484
484
|
# You'll usually call App#instances instead
|
485
|
-
def initialize(
|
486
|
-
@app =
|
487
|
-
@
|
485
|
+
def initialize(app, id, client, manifest = {})
|
486
|
+
@app = app
|
487
|
+
@id = id
|
488
488
|
@client = client
|
489
489
|
@manifest = manifest
|
490
490
|
end
|
491
491
|
|
492
492
|
# Show string representing the application instance.
|
493
493
|
def inspect
|
494
|
-
"#<App::Instance '
|
494
|
+
"#<App::Instance '#{@app.name}' \##@id>"
|
495
495
|
end
|
496
496
|
|
497
497
|
# Instance state.
|
@@ -543,7 +543,7 @@ module CFoundry::V1
|
|
543
543
|
#
|
544
544
|
# For example, <code>files("foo", "bar")</code> for +foo/bar+.
|
545
545
|
def files(*path)
|
546
|
-
@client.base.files(@app, @
|
546
|
+
@client.base.files(@app.name, @id, *path).split("\n").collect do |entry|
|
547
547
|
path + [entry.split(/\s+/, 2)[0]]
|
548
548
|
end
|
549
549
|
end
|
@@ -555,58 +555,7 @@ module CFoundry::V1
|
|
555
555
|
#
|
556
556
|
# For example, <code>files("foo", "bar")</code> for +foo/bar+.
|
557
557
|
def file(*path)
|
558
|
-
@client.base.files(@app, @
|
559
|
-
end
|
560
|
-
end
|
561
|
-
|
562
|
-
# Class represnting a crashed instance of an application.
|
563
|
-
class CrashedInstance
|
564
|
-
# The application this instance belonged to.
|
565
|
-
attr_reader :app
|
566
|
-
|
567
|
-
# Crashed instance (pseudo-)unique identifier.
|
568
|
-
attr_reader :id
|
569
|
-
|
570
|
-
# Create a CrashedInstance object.
|
571
|
-
#
|
572
|
-
# You'll usually call App#crashes instead
|
573
|
-
def initialize(appname, id, client, manifest = {})
|
574
|
-
@app = appname
|
575
|
-
@id = id
|
576
|
-
@client = client
|
577
|
-
@manifest = manifest
|
578
|
-
end
|
579
|
-
|
580
|
-
# Show string representing the application instance.
|
581
|
-
def inspect
|
582
|
-
"#<App::CrashedInstance '#@app' \##@id>"
|
583
|
-
end
|
584
|
-
|
585
|
-
# Instance crashed time.
|
586
|
-
def since
|
587
|
-
@manifest[:since] && Time.at(@manifest[:since])
|
588
|
-
end
|
589
|
-
|
590
|
-
# Retrieve file listing under path for this instance.
|
591
|
-
#
|
592
|
-
# [path]
|
593
|
-
# A sequence of strings representing path segments.
|
594
|
-
#
|
595
|
-
# For example, <code>files("foo", "bar")</code> for +foo/bar+.
|
596
|
-
def files(*path)
|
597
|
-
@client.base.files(@app, @id, *path).split("\n").collect do |entry|
|
598
|
-
path + [entry.split(/\s+/, 2)[0]]
|
599
|
-
end
|
600
|
-
end
|
601
|
-
|
602
|
-
# Retrieve file contents for this instance.
|
603
|
-
#
|
604
|
-
# [path]
|
605
|
-
# A sequence of strings representing path segments.
|
606
|
-
#
|
607
|
-
# For example, <code>file("foo", "bar")</code> for +foo/bar+.
|
608
|
-
def file(*path)
|
609
|
-
@client.base.files(@app, @id, *path)
|
558
|
+
@client.base.files(@app.name, @id, *path)
|
610
559
|
end
|
611
560
|
end
|
612
561
|
end
|
data/lib/cfoundry/v2/app.rb
CHANGED
@@ -36,6 +36,16 @@ module CFoundry::V2
|
|
36
36
|
|
37
37
|
private :environment_json, :environment_json=
|
38
38
|
|
39
|
+
def instances
|
40
|
+
@client.base.instances(@guid).collect do |i, m|
|
41
|
+
Instance.new(self, i.to_s, @client, m)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def stats
|
46
|
+
@client.base.stats(@guid)
|
47
|
+
end
|
48
|
+
|
39
49
|
def services
|
40
50
|
service_bindings.collect(&:service_instance)
|
41
51
|
end
|
@@ -196,11 +206,11 @@ module CFoundry::V2
|
|
196
206
|
end
|
197
207
|
|
198
208
|
def files(*path)
|
199
|
-
Instance.new(self, 0, @client).files(*path)
|
209
|
+
Instance.new(self, "0", @client).files(*path)
|
200
210
|
end
|
201
211
|
|
202
212
|
def file(*path)
|
203
|
-
Instance.new(self, 0, @client).file(*path)
|
213
|
+
Instance.new(self, "0", @client).file(*path)
|
204
214
|
end
|
205
215
|
|
206
216
|
class Instance
|
data/lib/cfoundry/v2/base.rb
CHANGED
@@ -105,6 +105,14 @@ module CFoundry::V2
|
|
105
105
|
end
|
106
106
|
alias :file :files
|
107
107
|
|
108
|
+
def instances(guid)
|
109
|
+
get("v2", "apps", guid, "instances", nil => :json)
|
110
|
+
end
|
111
|
+
|
112
|
+
def stats(guid)
|
113
|
+
get("v2", "apps", guid, "stats", nil => :json)
|
114
|
+
end
|
115
|
+
|
108
116
|
|
109
117
|
def params_from(args)
|
110
118
|
depth, query = args
|
data/lib/cfoundry/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cfoundry
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 41
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 29
|
10
|
+
version: 0.3.29
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Alex Suraci
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-09-
|
18
|
+
date: 2012-09-06 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rest-client
|