cfoundry 0.3.15 → 0.3.16
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 +54 -30
- data/lib/cfoundry/v1/service_instance.rb +5 -1
- data/lib/cfoundry/version.rb +1 -1
- metadata +4 -4
data/lib/cfoundry/v1/app.rb
CHANGED
@@ -86,7 +86,7 @@ module CFoundry::V1
|
|
86
86
|
#
|
87
87
|
# Call this after setting the various attributes.
|
88
88
|
def create!
|
89
|
-
@client.base.create_app(
|
89
|
+
@client.base.create_app(create_manifest)
|
90
90
|
@diff = {}
|
91
91
|
end
|
92
92
|
|
@@ -116,7 +116,7 @@ module CFoundry::V1
|
|
116
116
|
send(:"#{k}=", v)
|
117
117
|
end
|
118
118
|
|
119
|
-
@client.base.update_app(@name,
|
119
|
+
@client.base.update_app(@name, update_manifest)
|
120
120
|
|
121
121
|
@manifest = nil
|
122
122
|
@diff = {}
|
@@ -284,14 +284,14 @@ module CFoundry::V1
|
|
284
284
|
|
285
285
|
# Bind services to application.
|
286
286
|
def bind(*instances)
|
287
|
-
update!(:services => services + instances
|
287
|
+
update!(:services => services + instances)
|
288
288
|
end
|
289
289
|
|
290
290
|
# Unbind services from application.
|
291
291
|
def unbind(*instances)
|
292
292
|
update!(:services =>
|
293
293
|
services.reject { |s|
|
294
|
-
instances.any? { |i| i.name == s }
|
294
|
+
instances.any? { |i| i.name == s.name }
|
295
295
|
})
|
296
296
|
end
|
297
297
|
|
@@ -362,36 +362,60 @@ module CFoundry::V1
|
|
362
362
|
|
363
363
|
private
|
364
364
|
|
365
|
+
ATTR_MAP = {
|
366
|
+
:instances => :instances,
|
367
|
+
:state => :state,
|
368
|
+
:env => :env,
|
369
|
+
:uris => :uris,
|
370
|
+
:services => :services,
|
371
|
+
:debug => :debug,
|
372
|
+
|
373
|
+
:framework => [:staging, :model],
|
374
|
+
:runtime => [:staging, :stack],
|
375
|
+
:command => [:staging, :command],
|
376
|
+
|
377
|
+
:console => [:meta, :console],
|
378
|
+
:meta_version => [:meta, :version],
|
379
|
+
:created => [:meta, :created],
|
380
|
+
|
381
|
+
:memory => [:resources, :memory],
|
382
|
+
:disk => [:resources, :disk],
|
383
|
+
:fds => [:resources, :fds]
|
384
|
+
}
|
385
|
+
|
365
386
|
def manifest
|
366
387
|
@manifest ||= @client.base.app(@name)
|
367
388
|
end
|
368
389
|
|
369
|
-
def write_manifest
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
390
|
+
def write_manifest(body = read_manifest, onto = {})
|
391
|
+
onto[:name] = @name
|
392
|
+
|
393
|
+
ATTR_MAP.each do |what, where|
|
394
|
+
if body.key?(what)
|
395
|
+
put(body[what], onto, Array(where))
|
396
|
+
end
|
397
|
+
end
|
398
|
+
|
399
|
+
onto
|
400
|
+
end
|
401
|
+
|
402
|
+
def put(what, where, path)
|
403
|
+
if path.size == 1
|
404
|
+
where[path.last] = what
|
405
|
+
elsif name = path.shift
|
406
|
+
where[name] ||= {}
|
407
|
+
put(what, where[name], path)
|
408
|
+
end
|
409
|
+
|
410
|
+
nil
|
411
|
+
end
|
412
|
+
|
413
|
+
def update_manifest
|
414
|
+
write_manifest(@diff, write_manifest)
|
415
|
+
end
|
416
|
+
|
417
|
+
def create_manifest
|
418
|
+
write_manifest(@diff)
|
395
419
|
end
|
396
420
|
|
397
421
|
def read_manifest
|
@@ -38,7 +38,7 @@ module CFoundry::V1
|
|
38
38
|
|
39
39
|
# Show string representing the service.
|
40
40
|
def inspect
|
41
|
-
"#<
|
41
|
+
"#<ServiceInstance '#@name'>"
|
42
42
|
end
|
43
43
|
|
44
44
|
# Delete the service from the target.
|
@@ -71,6 +71,10 @@ module CFoundry::V1
|
|
71
71
|
Time.at(meta[:updated])
|
72
72
|
end
|
73
73
|
|
74
|
+
def invalidate!
|
75
|
+
@manifest = nil
|
76
|
+
end
|
77
|
+
|
74
78
|
{ :type => :type,
|
75
79
|
:vendor => :vendor,
|
76
80
|
:version => :version,
|
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: 51
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 16
|
10
|
+
version: 0.3.16
|
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-07-
|
18
|
+
date: 2012-07-30 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rest-client
|