cfoundry 0.3.33 → 0.3.34
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/client.rb +8 -0
- data/lib/cfoundry/v2/app.rb +42 -9
- data/lib/cfoundry/version.rb +1 -1
- metadata +7 -7
data/lib/cfoundry/v1/client.rb
CHANGED
@@ -95,6 +95,10 @@ module CFoundry::V1
|
|
95
95
|
runtimes
|
96
96
|
end
|
97
97
|
|
98
|
+
def runtime_by_name(name)
|
99
|
+
runtimes.find { |r| r.name == name }
|
100
|
+
end
|
101
|
+
|
98
102
|
# Retrieve available frameworks.
|
99
103
|
def frameworks
|
100
104
|
fs = info[:frameworks]
|
@@ -109,9 +113,13 @@ module CFoundry::V1
|
|
109
113
|
frameworks <<
|
110
114
|
Framework.new(name.to_s, nil, runtimes, meta[:detection])
|
111
115
|
end
|
116
|
+
|
112
117
|
frameworks
|
113
118
|
end
|
114
119
|
|
120
|
+
def framework_by_name(name)
|
121
|
+
frameworks.find { |f| f.name == name }
|
122
|
+
end
|
115
123
|
|
116
124
|
# Retrieve user list. Admin-only.
|
117
125
|
def users
|
data/lib/cfoundry/v2/app.rb
CHANGED
@@ -34,7 +34,7 @@ module CFoundry::V2
|
|
34
34
|
alias :total_instances :instances
|
35
35
|
alias :total_instances= :instances=
|
36
36
|
|
37
|
-
private :environment_json
|
37
|
+
private :environment_json
|
38
38
|
|
39
39
|
def instances
|
40
40
|
@client.base.instances(@guid).collect do |i, m|
|
@@ -53,14 +53,10 @@ module CFoundry::V2
|
|
53
53
|
def env
|
54
54
|
@env ||= CFoundry::ChattyHash.new(
|
55
55
|
method(:env=),
|
56
|
-
|
56
|
+
environment_json)
|
57
57
|
end
|
58
58
|
|
59
|
-
|
60
|
-
@env = hash
|
61
|
-
@diff["environment_json"] = hash
|
62
|
-
hash
|
63
|
-
end
|
59
|
+
alias :env= :environment_json=
|
64
60
|
|
65
61
|
def command # TODO v2
|
66
62
|
nil
|
@@ -81,16 +77,49 @@ module CFoundry::V2
|
|
81
77
|
end
|
82
78
|
alias :urls :uris
|
83
79
|
|
84
|
-
def uris=(
|
80
|
+
def uris=(uris)
|
85
81
|
raise "App#uris= is invalid against V2 APIs. Use add/remove_route."
|
86
82
|
end
|
87
83
|
alias :urls= :uris=
|
88
84
|
|
85
|
+
def create_routes(*uris)
|
86
|
+
uris.each do |uri|
|
87
|
+
host, domain_name = uri.split(".", 2)
|
88
|
+
|
89
|
+
domain =
|
90
|
+
@client.current_space.domains.find { |d|
|
91
|
+
d.name == domain_name
|
92
|
+
}
|
93
|
+
|
94
|
+
raise "Invalid domain '#{domain_name}'" unless domain
|
95
|
+
|
96
|
+
route = @client.routes.find { |r|
|
97
|
+
r.host == host && r.domain == domain
|
98
|
+
}
|
99
|
+
|
100
|
+
unless route
|
101
|
+
route = @client.route
|
102
|
+
route.host = host
|
103
|
+
route.domain = domain
|
104
|
+
route.organization = @client.current_organization
|
105
|
+
route.create!
|
106
|
+
end
|
107
|
+
|
108
|
+
add_route(route)
|
109
|
+
end
|
110
|
+
end
|
111
|
+
alias :create_route :create_routes
|
112
|
+
|
89
113
|
def uri
|
90
114
|
uris[0]
|
91
115
|
end
|
92
116
|
alias :url :uri
|
93
117
|
|
118
|
+
def uri=(x)
|
119
|
+
self.uris = [x]
|
120
|
+
end
|
121
|
+
alias :url= :uri=
|
122
|
+
|
94
123
|
# Stop the application.
|
95
124
|
def stop!
|
96
125
|
update! :state => "STOPPED"
|
@@ -121,7 +150,11 @@ module CFoundry::V2
|
|
121
150
|
def healthy?
|
122
151
|
# invalidate cache so the check is fresh
|
123
152
|
@manifest = nil
|
124
|
-
|
153
|
+
|
154
|
+
case health
|
155
|
+
when "RUNNING", "STARTED"
|
156
|
+
true
|
157
|
+
end
|
125
158
|
end
|
126
159
|
alias_method :running?, :healthy?
|
127
160
|
|
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: 87
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 34
|
10
|
+
version: 0.3.34
|
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-18 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rest-client
|
@@ -57,12 +57,12 @@ dependencies:
|
|
57
57
|
requirements:
|
58
58
|
- - ~>
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
hash:
|
60
|
+
hash: 41
|
61
61
|
segments:
|
62
62
|
- 0
|
63
63
|
- 9
|
64
|
-
-
|
65
|
-
version: 0.9.
|
64
|
+
- 9
|
65
|
+
version: 0.9.9
|
66
66
|
type: :runtime
|
67
67
|
version_requirements: *id003
|
68
68
|
- !ruby/object:Gem::Dependency
|