cfoundry 2.4.1.rc1 → 3.0.0
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/v2/app.rb +6 -6
- data/lib/cfoundry/v2/base.rb +2 -3
- data/lib/cfoundry/version.rb +1 -1
- data/spec/cfoundry/v2/app_spec.rb +35 -33
- metadata +9 -6
data/lib/cfoundry/v2/app.rb
CHANGED
@@ -137,19 +137,19 @@ module CFoundry::V2
|
|
137
137
|
end
|
138
138
|
|
139
139
|
# Start the application.
|
140
|
-
def start!(
|
140
|
+
def start!(&blk)
|
141
141
|
self.state = "STARTED"
|
142
|
-
update!(
|
142
|
+
update!(&blk)
|
143
143
|
end
|
144
144
|
|
145
145
|
# Restart the application.
|
146
|
-
def restart!(
|
146
|
+
def restart!(&blk)
|
147
147
|
stop!
|
148
|
-
start!(
|
148
|
+
start!(&blk)
|
149
149
|
end
|
150
150
|
|
151
|
-
def update!
|
152
|
-
response = @client.base.update_app(@guid, @diff
|
151
|
+
def update!
|
152
|
+
response = @client.base.update_app(@guid, @diff)
|
153
153
|
|
154
154
|
yield response[:headers]["x-app-staging-log"] if block_given?
|
155
155
|
|
data/lib/cfoundry/v2/base.rb
CHANGED
@@ -61,12 +61,11 @@ module CFoundry::V2
|
|
61
61
|
get("v2", "apps", guid, "stats", :accept => :json)
|
62
62
|
end
|
63
63
|
|
64
|
-
def update_app(guid, diff
|
64
|
+
def update_app(guid, diff)
|
65
65
|
put("v2", "apps", guid,
|
66
66
|
:content => :json,
|
67
67
|
:payload => diff,
|
68
|
-
:return_response => true
|
69
|
-
:params => { :stage_async => !!async })
|
68
|
+
:return_response => true)
|
70
69
|
end
|
71
70
|
|
72
71
|
def all_pages(paginated)
|
data/lib/cfoundry/version.rb
CHANGED
@@ -78,62 +78,64 @@ module CFoundry
|
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
81
|
+
it "sends the PUT request" do
|
82
|
+
client.base.should_receive(:put).with(
|
83
|
+
"v2", "apps", subject.guid,
|
84
|
+
hash_including(
|
85
|
+
:return_response => true)) do
|
86
|
+
response
|
87
|
+
end
|
88
|
+
|
89
|
+
update
|
90
|
+
end
|
91
|
+
|
92
|
+
context "and a block is given" do
|
93
|
+
let(:response) do
|
94
|
+
{ :headers => { "x-app-staging-log" => "http://app/staging/log" },
|
95
|
+
:body => "{}"
|
96
|
+
}
|
97
|
+
end
|
98
|
+
|
99
|
+
it "yields the URL for the logs" do
|
100
|
+
yielded_url = nil
|
101
|
+
update do |url|
|
102
|
+
yielded_url = url
|
89
103
|
end
|
90
104
|
|
91
|
-
|
105
|
+
expect(yielded_url).to eq "http://app/staging/log"
|
92
106
|
end
|
93
107
|
|
94
|
-
context "and
|
108
|
+
context "and no staging header is returned" do
|
95
109
|
let(:response) do
|
96
|
-
{:headers => {
|
110
|
+
{ :headers => {},
|
97
111
|
:body => "{}"
|
98
112
|
}
|
99
113
|
end
|
100
114
|
|
101
|
-
it "yields
|
102
|
-
yielded_url =
|
103
|
-
update
|
115
|
+
it "yields nil" do
|
116
|
+
yielded_url = :something
|
117
|
+
update do |url|
|
104
118
|
yielded_url = url
|
105
119
|
end
|
106
120
|
|
107
|
-
expect(yielded_url).to
|
121
|
+
expect(yielded_url).to be_nil
|
108
122
|
end
|
109
123
|
end
|
110
124
|
end
|
111
|
-
|
112
|
-
context "when asynchronous is false" do
|
113
|
-
it "sends the PUT request with &stage_async=false" do
|
114
|
-
client.base.should_receive(:put).with(
|
115
|
-
"v2", "apps", subject.guid,
|
116
|
-
hash_including(:params => {:stage_async => false})) do
|
117
|
-
response
|
118
|
-
end
|
119
|
-
|
120
|
-
update(false)
|
121
|
-
end
|
122
|
-
end
|
123
125
|
end
|
124
126
|
|
125
127
|
describe "#start!" do
|
126
128
|
it_should_behave_like "something may stage the app" do
|
127
|
-
def update(
|
128
|
-
subject.start!(
|
129
|
+
def update(&blk)
|
130
|
+
subject.start!(&blk)
|
129
131
|
end
|
130
132
|
end
|
131
133
|
end
|
132
134
|
|
133
135
|
describe "#restart!" do
|
134
136
|
it_should_behave_like "something may stage the app" do
|
135
|
-
def update(
|
136
|
-
subject.restart!(
|
137
|
+
def update(&blk)
|
138
|
+
subject.restart!(&blk)
|
137
139
|
end
|
138
140
|
end
|
139
141
|
end
|
@@ -157,8 +159,8 @@ module CFoundry
|
|
157
159
|
end
|
158
160
|
|
159
161
|
it_should_behave_like "something may stage the app" do
|
160
|
-
def update(
|
161
|
-
subject.update!(
|
162
|
+
def update(&blk)
|
163
|
+
subject.update!(&blk)
|
162
164
|
end
|
163
165
|
end
|
164
166
|
end
|
metadata
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cfoundry
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
5
|
-
prerelease:
|
4
|
+
version: 3.0.0
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Cloud Foundry Team
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-07-
|
13
|
+
date: 2013-07-18 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activemodel
|
@@ -419,13 +419,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
419
419
|
version: '0'
|
420
420
|
segments:
|
421
421
|
- 0
|
422
|
-
hash:
|
422
|
+
hash: 4045201048666946127
|
423
423
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
424
424
|
none: false
|
425
425
|
requirements:
|
426
|
-
- - ! '
|
426
|
+
- - ! '>='
|
427
427
|
- !ruby/object:Gem::Version
|
428
|
-
version:
|
428
|
+
version: '0'
|
429
|
+
segments:
|
430
|
+
- 0
|
431
|
+
hash: 4045201048666946127
|
429
432
|
requirements: []
|
430
433
|
rubyforge_project: cfoundry
|
431
434
|
rubygems_version: 1.8.25
|