pogo 2.32.14 → 2.39.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +0 -2
- data/lib/heroku/auth.rb +3 -1
- data/lib/heroku/client.rb +8 -5
- data/lib/heroku/client/cisaurus.rb +25 -0
- data/lib/heroku/client/heroku_postgresql.rb +0 -3
- data/lib/heroku/client/rendezvous.rb +2 -1
- data/lib/heroku/command.rb +1 -1
- data/lib/heroku/command/addons.rb +11 -2
- data/lib/heroku/command/apps.rb +105 -20
- data/lib/heroku/command/base.rb +1 -1
- data/lib/heroku/command/certs.rb +95 -34
- data/lib/heroku/command/config.rb +5 -5
- data/lib/heroku/command/domains.rb +4 -4
- data/lib/heroku/command/fork.rb +160 -0
- data/lib/heroku/command/git.rb +19 -20
- data/lib/heroku/command/help.rb +18 -2
- data/lib/heroku/command/keys.rb +1 -1
- data/lib/heroku/command/labs.rb +1 -1
- data/lib/heroku/command/logs.rb +3 -56
- data/lib/heroku/command/maintenance.rb +2 -2
- data/lib/heroku/command/pg.rb +7 -16
- data/lib/heroku/command/pgbackups.rb +37 -17
- data/lib/heroku/command/ps.rb +82 -35
- data/lib/heroku/command/regions.rb +23 -0
- data/lib/heroku/command/releases.rb +3 -3
- data/lib/heroku/command/run.rb +40 -27
- data/lib/heroku/command/sharing.rb +4 -4
- data/lib/heroku/command/ssl.rb +7 -25
- data/lib/heroku/command/stack.rb +1 -1
- data/lib/heroku/helpers/heroku_postgresql.rb +13 -17
- data/lib/heroku/helpers/log_displayer.rb +70 -0
- data/lib/heroku/plugin.rb +3 -0
- data/lib/heroku/updater.rb +11 -2
- data/lib/heroku/version.rb +1 -1
- data/spec/heroku/auth_spec.rb +10 -0
- data/spec/heroku/client/ssl_endpoint_spec.rb +12 -12
- data/spec/heroku/client_spec.rb +100 -100
- data/spec/heroku/command/addons_spec.rb +63 -59
- data/spec/heroku/command/apps_spec.rb +68 -65
- data/spec/heroku/command/base_spec.rb +21 -21
- data/spec/heroku/command/certs_spec.rb +31 -31
- data/spec/heroku/command/config_spec.rb +18 -18
- data/spec/heroku/command/db_spec.rb +3 -3
- data/spec/heroku/command/domains_spec.rb +13 -13
- data/spec/heroku/command/drains_spec.rb +3 -3
- data/spec/heroku/command/fork_spec.rb +56 -0
- data/spec/heroku/command/git_spec.rb +57 -29
- data/spec/heroku/command/labs_spec.rb +8 -8
- data/spec/heroku/command/logs_spec.rb +3 -3
- data/spec/heroku/command/maintenance_spec.rb +5 -5
- data/spec/heroku/command/pg_spec.rb +11 -25
- data/spec/heroku/command/pgbackups_spec.rb +13 -8
- data/spec/heroku/command/ps_spec.rb +23 -23
- data/spec/heroku/command/releases_spec.rb +22 -24
- data/spec/heroku/command/run_spec.rb +12 -15
- data/spec/heroku/command/sharing_spec.rb +9 -9
- data/spec/heroku/command/stack_spec.rb +4 -4
- data/spec/heroku/command_spec.rb +12 -12
- data/spec/heroku/helpers/heroku_postgresql_spec.rb +35 -14
- data/spec/spec_helper.rb +17 -2
- data/spec/support/openssl_mock_helper.rb +1 -1
- metadata +11 -6
- data/spec/heroku/command/ssl_spec.rb +0 -32
@@ -5,25 +5,25 @@ module Heroku::Command
|
|
5
5
|
describe Addons do
|
6
6
|
before do
|
7
7
|
@addons = prepare_command(Addons)
|
8
|
-
stub_core.release("
|
8
|
+
stub_core.release("example", "current").returns( "name" => "v99" )
|
9
9
|
end
|
10
10
|
|
11
11
|
describe "index" do
|
12
12
|
|
13
13
|
before(:each) do
|
14
14
|
stub_core
|
15
|
-
api.post_app("name" => "
|
15
|
+
api.post_app("name" => "example", "stack" => "cedar")
|
16
16
|
end
|
17
17
|
|
18
18
|
after(:each) do
|
19
|
-
api.delete_app("
|
19
|
+
api.delete_app("example")
|
20
20
|
end
|
21
21
|
|
22
22
|
it "should display no addons when none are configured" do
|
23
23
|
stderr, stdout = execute("addons")
|
24
24
|
stderr.should == ""
|
25
25
|
stdout.should == <<-STDOUT
|
26
|
-
|
26
|
+
example has no add-ons.
|
27
27
|
STDOUT
|
28
28
|
end
|
29
29
|
|
@@ -32,7 +32,7 @@ STDOUT
|
|
32
32
|
{
|
33
33
|
:expects => 200,
|
34
34
|
:method => :get,
|
35
|
-
:path => %r{^/apps/
|
35
|
+
:path => %r{^/apps/example/addons$}
|
36
36
|
},
|
37
37
|
{
|
38
38
|
:body => Heroku::API::OkJson.encode([
|
@@ -46,12 +46,12 @@ STDOUT
|
|
46
46
|
stderr, stdout = execute("addons")
|
47
47
|
stderr.should == ""
|
48
48
|
stdout.should == <<-STDOUT
|
49
|
-
===
|
49
|
+
=== example Configured Add-ons
|
50
50
|
deployhooks:http
|
51
51
|
heroku-postgresql:ronin HEROKU_POSTGRESQL_RED
|
52
52
|
|
53
|
-
===
|
54
|
-
deployhooks:email https://api.heroku.com/
|
53
|
+
=== example Add-ons to Configure
|
54
|
+
deployhooks:email https://api.heroku.com/apps/example/addons/deployhooks:email
|
55
55
|
|
56
56
|
STDOUT
|
57
57
|
Excon.stubs.shift
|
@@ -60,7 +60,14 @@ STDOUT
|
|
60
60
|
end
|
61
61
|
|
62
62
|
describe "list" do
|
63
|
-
|
63
|
+
|
64
|
+
it "sends region option to the server" do
|
65
|
+
stub_request(:get, %r{/addons\?region=eu$}).
|
66
|
+
to_return(:body => Heroku::OkJson.encode([]))
|
67
|
+
execute("addons:list --region=eu")
|
68
|
+
end
|
69
|
+
|
70
|
+
it "lists available addons" do
|
64
71
|
stub_core.addons.returns([
|
65
72
|
{ "name" => "cloudcounter:basic", "state" => "alpha" },
|
66
73
|
{ "name" => "cloudcounter:pro", "state" => "public" },
|
@@ -68,9 +75,6 @@ STDOUT
|
|
68
75
|
{ "name" => "cloudcounter:old", "state" => "disabled" },
|
69
76
|
{ "name" => "cloudcounter:platinum", "state" => "beta" }
|
70
77
|
])
|
71
|
-
end
|
72
|
-
|
73
|
-
it "lists available addons" do
|
74
78
|
stderr, stdout = execute("addons:list")
|
75
79
|
stderr.should == ""
|
76
80
|
stdout.should == <<-STDOUT
|
@@ -93,19 +97,19 @@ STDOUT
|
|
93
97
|
describe 'v1-style command line params' do
|
94
98
|
it "understands foo=baz" do
|
95
99
|
@addons.stub!(:args).and_return(%w(my_addon foo=baz))
|
96
|
-
@addons.heroku.should_receive(:install_addon).with('
|
100
|
+
@addons.heroku.should_receive(:install_addon).with('example', 'my_addon', { 'foo' => 'baz' })
|
97
101
|
@addons.add
|
98
102
|
end
|
99
103
|
|
100
104
|
it "gives a deprecation notice with an example" do
|
101
|
-
stub_request(:post, %r{apps/
|
105
|
+
stub_request(:post, %r{apps/example/addons/my_addon$}).
|
102
106
|
with(:body => {:config => {:foo => 'bar', :extra => "XXX"}}).
|
103
107
|
to_return(:body => Heroku::OkJson.encode({ 'price' => 'free' }))
|
104
108
|
Excon.stub(
|
105
109
|
{
|
106
110
|
:expects => 200,
|
107
111
|
:method => :get,
|
108
|
-
:path => %r{^/apps/
|
112
|
+
:path => %r{^/apps/example/releases/current}
|
109
113
|
},
|
110
114
|
{
|
111
115
|
:body => Heroku::API::OkJson.encode({ 'name' => 'v99' }),
|
@@ -116,7 +120,7 @@ STDOUT
|
|
116
120
|
stderr.should == ""
|
117
121
|
stdout.should == <<-STDOUT
|
118
122
|
Warning: non-unix style params have been deprecated, use --extra=XXX instead
|
119
|
-
Adding my_addon on
|
123
|
+
Adding my_addon on example... done, v99 (free)
|
120
124
|
Use `heroku addons:docs my_addon` to view documentation.
|
121
125
|
STDOUT
|
122
126
|
Excon.stubs.shift
|
@@ -126,36 +130,36 @@ STDOUT
|
|
126
130
|
describe 'unix-style command line params' do
|
127
131
|
it "understands --foo=baz" do
|
128
132
|
@addons.stub!(:args).and_return(%w(my_addon --foo=baz))
|
129
|
-
@addons.heroku.should_receive(:install_addon).with('
|
133
|
+
@addons.heroku.should_receive(:install_addon).with('example', 'my_addon', { 'foo' => 'baz' })
|
130
134
|
@addons.add
|
131
135
|
end
|
132
136
|
|
133
137
|
it "understands --foo baz" do
|
134
138
|
@addons.stub!(:args).and_return(%w(my_addon --foo baz))
|
135
|
-
@addons.heroku.should_receive(:install_addon).with('
|
139
|
+
@addons.heroku.should_receive(:install_addon).with('example', 'my_addon', { 'foo' => 'baz' })
|
136
140
|
@addons.add
|
137
141
|
end
|
138
142
|
|
139
143
|
it "treats lone switches as true" do
|
140
144
|
@addons.stub!(:args).and_return(%w(my_addon --foo))
|
141
|
-
@addons.heroku.should_receive(:install_addon).with('
|
145
|
+
@addons.heroku.should_receive(:install_addon).with('example', 'my_addon', { 'foo' => true })
|
142
146
|
@addons.add
|
143
147
|
end
|
144
148
|
|
145
149
|
it "converts 'true' to boolean" do
|
146
150
|
@addons.stub!(:args).and_return(%w(my_addon --foo=true))
|
147
|
-
@addons.heroku.should_receive(:install_addon).with('
|
151
|
+
@addons.heroku.should_receive(:install_addon).with('example', 'my_addon', { 'foo' => true })
|
148
152
|
@addons.add
|
149
153
|
end
|
150
154
|
|
151
155
|
it "works with many config vars" do
|
152
156
|
@addons.stub!(:args).and_return(%w(my_addon --foo baz --bar yes --baz=foo --bab --bob=true))
|
153
|
-
@addons.heroku.should_receive(:install_addon).with('
|
157
|
+
@addons.heroku.should_receive(:install_addon).with('example', 'my_addon', { 'foo' => 'baz', 'bar' => 'yes', 'baz' => 'foo', 'bab' => true, 'bob' => true })
|
154
158
|
@addons.add
|
155
159
|
end
|
156
160
|
|
157
161
|
it "sends the variables to the server" do
|
158
|
-
stub_request(:post, %r{apps/
|
162
|
+
stub_request(:post, %r{apps/example/addons/my_addon$}).
|
159
163
|
with(:body => {:config => { 'foo' => 'baz', 'bar' => 'yes', 'baz' => 'foo', 'bab' => 'true', 'bob' => 'true' }})
|
160
164
|
stderr, stdout = execute("addons:add my_addon --foo baz --bar yes --baz=foo --bab --bob=true")
|
161
165
|
stderr.should == ""
|
@@ -170,12 +174,12 @@ STDOUT
|
|
170
174
|
describe "mixed options" do
|
171
175
|
it "understands foo=bar and --baz=bar on the same line" do
|
172
176
|
@addons.stub!(:args).and_return(%w(my_addon foo=baz --baz=bar bob=true --bar))
|
173
|
-
@addons.heroku.should_receive(:install_addon).with('
|
177
|
+
@addons.heroku.should_receive(:install_addon).with('example', 'my_addon', { 'foo' => 'baz', 'baz' => 'bar', 'bar' => true, 'bob' => true })
|
174
178
|
@addons.add
|
175
179
|
end
|
176
180
|
|
177
181
|
it "sends the variables to the server" do
|
178
|
-
stub_request(:post, %r{apps/
|
182
|
+
stub_request(:post, %r{apps/example/addons/my_addon$}).
|
179
183
|
with(:body => {:config => { 'foo' => 'baz', 'baz' => 'bar', 'bar' => 'true', 'bob' => 'true' }})
|
180
184
|
stderr, stdout = execute("addons:add my_addon foo=baz --baz=bar bob=true --bar")
|
181
185
|
stderr.should == ""
|
@@ -188,7 +192,7 @@ STDOUT
|
|
188
192
|
%w{fork follow}.each do |switch|
|
189
193
|
@addons.stub!(:args).and_return("addon --#{switch} HEROKU_POSTGRESQL_RED".split)
|
190
194
|
@addons.heroku.should_receive(:install_addon).
|
191
|
-
with('
|
195
|
+
with('example', 'addon', {switch => 'HEROKU_POSTGRESQL_RED'})
|
192
196
|
@addons.add
|
193
197
|
end
|
194
198
|
end
|
@@ -203,7 +207,7 @@ STDOUT
|
|
203
207
|
'type' => 'heroku-postgresql:ronin' }})
|
204
208
|
])
|
205
209
|
@addons.stub!(:args).and_return("heroku-postgresql --#{switch} HEROKU_POSTGRESQL_RED".split)
|
206
|
-
@addons.heroku.should_receive(:install_addon).with('
|
210
|
+
@addons.heroku.should_receive(:install_addon).with('example', 'heroku-postgresql', {switch => 'postgres://red_url'})
|
207
211
|
@addons.add
|
208
212
|
end
|
209
213
|
end
|
@@ -213,7 +217,7 @@ STDOUT
|
|
213
217
|
@addons.stub!(:app_config_vars).and_return({})
|
214
218
|
@addons.stub!(:app_attachments).and_return([])
|
215
219
|
@addons.stub!(:args).and_return("heroku-postgresql --#{switch} postgres://foo:yeah@awesome.com:234/bestdb".split)
|
216
|
-
@addons.heroku.should_receive(:install_addon).with('
|
220
|
+
@addons.heroku.should_receive(:install_addon).with('example', 'heroku-postgresql', {switch => 'postgres://foo:yeah@awesome.com:234/bestdb'})
|
217
221
|
@addons.add
|
218
222
|
end
|
219
223
|
end
|
@@ -226,7 +230,7 @@ STDOUT
|
|
226
230
|
{
|
227
231
|
:expects => 200,
|
228
232
|
:method => :get,
|
229
|
-
:path => %r{^/apps/
|
233
|
+
:path => %r{^/apps/example/releases/current}
|
230
234
|
},
|
231
235
|
{
|
232
236
|
:body => Heroku::API::OkJson.encode({ 'name' => 'v99' }),
|
@@ -246,34 +250,34 @@ STDOUT
|
|
246
250
|
|
247
251
|
it "adds an addon" do
|
248
252
|
@addons.stub!(:args).and_return(%w(my_addon))
|
249
|
-
@addons.heroku.should_receive(:install_addon).with('
|
253
|
+
@addons.heroku.should_receive(:install_addon).with('example', 'my_addon', {})
|
250
254
|
@addons.add
|
251
255
|
end
|
252
256
|
|
253
257
|
it "adds an addon with a price" do
|
254
|
-
stub_core.install_addon("
|
258
|
+
stub_core.install_addon("example", "my_addon", {}).returns({ "price" => "free" })
|
255
259
|
stderr, stdout = execute("addons:add my_addon")
|
256
260
|
stderr.should == ""
|
257
261
|
stdout.should =~ /\(free\)/
|
258
262
|
end
|
259
263
|
|
260
264
|
it "adds an addon with a price and message" do
|
261
|
-
stub_core.install_addon("
|
265
|
+
stub_core.install_addon("example", "my_addon", {}).returns({ "price" => "free", "message" => "foo" })
|
262
266
|
stderr, stdout = execute("addons:add my_addon")
|
263
267
|
stderr.should == ""
|
264
268
|
stdout.should == <<-OUTPUT
|
265
|
-
Adding my_addon on
|
269
|
+
Adding my_addon on example... done, v99 (free)
|
266
270
|
foo
|
267
271
|
Use `heroku addons:docs my_addon` to view documentation.
|
268
272
|
OUTPUT
|
269
273
|
end
|
270
274
|
|
271
275
|
it "adds an addon with a price and multiline message" do
|
272
|
-
stub_core.install_addon("
|
276
|
+
stub_core.install_addon("example", "my_addon", {}).returns({ "price" => "$200/mo", "message" => "foo\nbar" })
|
273
277
|
stderr, stdout = execute("addons:add my_addon")
|
274
278
|
stderr.should == ""
|
275
279
|
stdout.should == <<-OUTPUT
|
276
|
-
Adding my_addon on
|
280
|
+
Adding my_addon on example... done, v99 ($200/mo)
|
277
281
|
foo
|
278
282
|
bar
|
279
283
|
Use `heroku addons:docs my_addon` to view documentation.
|
@@ -293,7 +297,7 @@ OUTPUT
|
|
293
297
|
{
|
294
298
|
:expects => 200,
|
295
299
|
:method => :get,
|
296
|
-
:path => %r{^/apps/
|
300
|
+
:path => %r{^/apps/example/releases/current}
|
297
301
|
},
|
298
302
|
{
|
299
303
|
:body => Heroku::API::OkJson.encode({ 'name' => 'v99' }),
|
@@ -312,32 +316,32 @@ OUTPUT
|
|
312
316
|
|
313
317
|
it "upgrades an addon" do
|
314
318
|
@addons.stub!(:args).and_return(%w(my_addon))
|
315
|
-
@addons.heroku.should_receive(:upgrade_addon).with('
|
319
|
+
@addons.heroku.should_receive(:upgrade_addon).with('example', 'my_addon', {})
|
316
320
|
@addons.upgrade
|
317
321
|
end
|
318
322
|
|
319
323
|
it "upgrade an addon with config vars" do
|
320
324
|
@addons.stub!(:args).and_return(%w(my_addon --foo=baz))
|
321
|
-
@addons.heroku.should_receive(:upgrade_addon).with('
|
325
|
+
@addons.heroku.should_receive(:upgrade_addon).with('example', 'my_addon', { 'foo' => 'baz' })
|
322
326
|
@addons.upgrade
|
323
327
|
end
|
324
328
|
|
325
329
|
it "adds an addon with a price" do
|
326
|
-
stub_core.upgrade_addon("
|
330
|
+
stub_core.upgrade_addon("example", "my_addon", {}).returns({ "price" => "free" })
|
327
331
|
stderr, stdout = execute("addons:upgrade my_addon")
|
328
332
|
stderr.should == ""
|
329
333
|
stdout.should == <<-OUTPUT
|
330
|
-
Upgrading to my_addon on
|
334
|
+
Upgrading to my_addon on example... done, v99 (free)
|
331
335
|
Use `heroku addons:docs my_addon` to view documentation.
|
332
336
|
OUTPUT
|
333
337
|
end
|
334
338
|
|
335
339
|
it "adds an addon with a price and message" do
|
336
|
-
stub_core.upgrade_addon("
|
340
|
+
stub_core.upgrade_addon("example", "my_addon", {}).returns({ "price" => "free", "message" => "Don't Panic" })
|
337
341
|
stderr, stdout = execute("addons:upgrade my_addon")
|
338
342
|
stderr.should == ""
|
339
343
|
stdout.should == <<-OUTPUT
|
340
|
-
Upgrading to my_addon on
|
344
|
+
Upgrading to my_addon on example... done, v99 (free)
|
341
345
|
Don't Panic
|
342
346
|
Use `heroku addons:docs my_addon` to view documentation.
|
343
347
|
OUTPUT
|
@@ -351,7 +355,7 @@ OUTPUT
|
|
351
355
|
{
|
352
356
|
:expects => 200,
|
353
357
|
:method => :get,
|
354
|
-
:path => %r{^/apps/
|
358
|
+
:path => %r{^/apps/example/releases/current}
|
355
359
|
},
|
356
360
|
{
|
357
361
|
:body => Heroku::API::OkJson.encode({ 'name' => 'v99' }),
|
@@ -370,32 +374,32 @@ OUTPUT
|
|
370
374
|
|
371
375
|
it "downgrades an addon" do
|
372
376
|
@addons.stub!(:args).and_return(%w(my_addon))
|
373
|
-
@addons.heroku.should_receive(:upgrade_addon).with('
|
377
|
+
@addons.heroku.should_receive(:upgrade_addon).with('example', 'my_addon', {})
|
374
378
|
@addons.downgrade
|
375
379
|
end
|
376
380
|
|
377
381
|
it "downgrade an addon with config vars" do
|
378
382
|
@addons.stub!(:args).and_return(%w(my_addon --foo=baz))
|
379
|
-
@addons.heroku.should_receive(:upgrade_addon).with('
|
383
|
+
@addons.heroku.should_receive(:upgrade_addon).with('example', 'my_addon', { 'foo' => 'baz' })
|
380
384
|
@addons.downgrade
|
381
385
|
end
|
382
386
|
|
383
387
|
it "downgrades an addon with a price" do
|
384
|
-
stub_core.upgrade_addon("
|
388
|
+
stub_core.upgrade_addon("example", "my_addon", {}).returns({ "price" => "free" })
|
385
389
|
stderr, stdout = execute("addons:downgrade my_addon")
|
386
390
|
stderr.should == ""
|
387
391
|
stdout.should == <<-OUTPUT
|
388
|
-
Downgrading to my_addon on
|
392
|
+
Downgrading to my_addon on example... done, v99 (free)
|
389
393
|
Use `heroku addons:docs my_addon` to view documentation.
|
390
394
|
OUTPUT
|
391
395
|
end
|
392
396
|
|
393
397
|
it "downgrades an addon with a price and message" do
|
394
|
-
stub_core.upgrade_addon("
|
398
|
+
stub_core.upgrade_addon("example", "my_addon", {}).returns({ "price" => "free", "message" => "Don't Panic" })
|
395
399
|
stderr, stdout = execute("addons:downgrade my_addon")
|
396
400
|
stderr.should == ""
|
397
401
|
stdout.should == <<-OUTPUT
|
398
|
-
Downgrading to my_addon on
|
402
|
+
Downgrading to my_addon on example... done, v99 (free)
|
399
403
|
Don't Panic
|
400
404
|
Use `heroku addons:docs my_addon` to view documentation.
|
401
405
|
OUTPUT
|
@@ -423,14 +427,14 @@ OUTPUT
|
|
423
427
|
it "removes addons after prompting for confirmation" do
|
424
428
|
@addons.stub!(:args).and_return(%w( addon1 ))
|
425
429
|
@addons.should_receive(:confirm_command).once.and_return(true)
|
426
|
-
@addons.heroku.should_receive(:uninstall_addon).with('
|
430
|
+
@addons.heroku.should_receive(:uninstall_addon).with('example', 'addon1', :confirm => "example")
|
427
431
|
@addons.remove
|
428
432
|
end
|
429
433
|
|
430
434
|
it "removes addons with confirm option" do
|
431
|
-
Heroku::Command.stub!(:current_options).and_return(:confirm => "
|
435
|
+
Heroku::Command.stub!(:current_options).and_return(:confirm => "example")
|
432
436
|
@addons.stub!(:args).and_return(%w( addon1 ))
|
433
|
-
@addons.heroku.should_receive(:uninstall_addon).with('
|
437
|
+
@addons.heroku.should_receive(:uninstall_addon).with('example', 'addon1', :confirm => "example")
|
434
438
|
@addons.remove
|
435
439
|
end
|
436
440
|
|
@@ -438,11 +442,11 @@ OUTPUT
|
|
438
442
|
|
439
443
|
before(:each) do
|
440
444
|
stub_core
|
441
|
-
api.post_app("name" => "
|
445
|
+
api.post_app("name" => "example", "stack" => "cedar")
|
442
446
|
end
|
443
447
|
|
444
448
|
after(:each) do
|
445
|
-
api.delete_app("
|
449
|
+
api.delete_app("example")
|
446
450
|
end
|
447
451
|
|
448
452
|
it "displays usage when no argument is specified" do
|
@@ -519,11 +523,11 @@ STDOUT
|
|
519
523
|
|
520
524
|
before(:each) do
|
521
525
|
stub_core
|
522
|
-
api.post_app("name" => "
|
526
|
+
api.post_app("name" => "example", "stack" => "cedar")
|
523
527
|
end
|
524
528
|
|
525
529
|
after(:each) do
|
526
|
-
api.delete_app("
|
530
|
+
api.delete_app("example")
|
527
531
|
end
|
528
532
|
|
529
533
|
it "displays usage when no argument is specified" do
|
@@ -536,13 +540,13 @@ STDERR
|
|
536
540
|
end
|
537
541
|
|
538
542
|
it "opens the addon if only one matches" do
|
539
|
-
api.post_addon('
|
543
|
+
api.post_addon('example', 'redistogo:nano')
|
540
544
|
require("launchy")
|
541
|
-
Launchy.should_receive(:open).with("https://api.#{@addons.heroku.host}/
|
545
|
+
Launchy.should_receive(:open).with("https://api.#{@addons.heroku.host}/apps/example/addons/redistogo:nano").and_return(Thread.new {})
|
542
546
|
stderr, stdout = execute('addons:open redistogo:nano')
|
543
547
|
stderr.should == ''
|
544
548
|
stdout.should == <<-STDOUT
|
545
|
-
Opening redistogo:nano for
|
549
|
+
Opening redistogo:nano for example... done
|
546
550
|
STDOUT
|
547
551
|
end
|
548
552
|
|
@@ -551,7 +555,7 @@ STDOUT
|
|
551
555
|
{
|
552
556
|
:expects => 200,
|
553
557
|
:method => :get,
|
554
|
-
:path => %r{^/apps/
|
558
|
+
:path => %r{^/apps/example/addons$}
|
555
559
|
},
|
556
560
|
{
|
557
561
|
:body => Heroku::API::OkJson.encode([
|
@@ -11,34 +11,36 @@ module Heroku::Command
|
|
11
11
|
context("info") do
|
12
12
|
|
13
13
|
before(:each) do
|
14
|
-
api.post_app("name" => "
|
14
|
+
api.post_app("name" => "example", "stack" => "cedar")
|
15
15
|
end
|
16
16
|
|
17
17
|
after(:each) do
|
18
|
-
api.delete_app("
|
18
|
+
api.delete_app("example")
|
19
19
|
end
|
20
20
|
|
21
21
|
it "displays impicit app info" do
|
22
22
|
stderr, stdout = execute("apps:info")
|
23
23
|
stderr.should == ""
|
24
24
|
stdout.should == <<-STDOUT
|
25
|
-
===
|
26
|
-
Git URL: git@heroku.com:
|
25
|
+
=== example
|
26
|
+
Git URL: git@heroku.com:example.git
|
27
27
|
Owner Email: email@example.com
|
28
28
|
Stack: cedar
|
29
|
-
|
29
|
+
Tier: Legacy
|
30
|
+
Web URL: http://example.herokuapp.com/
|
30
31
|
STDOUT
|
31
32
|
end
|
32
33
|
|
33
34
|
it "gets explicit app from --app" do
|
34
|
-
stderr, stdout = execute("apps:info --app
|
35
|
+
stderr, stdout = execute("apps:info --app example")
|
35
36
|
stderr.should == ""
|
36
37
|
stdout.should == <<-STDOUT
|
37
|
-
===
|
38
|
-
Git URL: git@heroku.com:
|
38
|
+
=== example
|
39
|
+
Git URL: git@heroku.com:example.git
|
39
40
|
Owner Email: email@example.com
|
40
41
|
Stack: cedar
|
41
|
-
|
42
|
+
Tier: Legacy
|
43
|
+
Web URL: http://example.herokuapp.com/
|
42
44
|
STDOUT
|
43
45
|
end
|
44
46
|
|
@@ -49,16 +51,17 @@ STDOUT
|
|
49
51
|
create_status=complete
|
50
52
|
created_at=\\d{4}/\\d{2}/\\d{2} \\d{2}:\\d{2}:\\d{2} [+-]\\d{4}
|
51
53
|
dynos=0
|
52
|
-
git_url=git@heroku.com:
|
54
|
+
git_url=git@heroku.com:example.git
|
53
55
|
id=\\d{1,5}
|
54
|
-
name=
|
56
|
+
name=example
|
55
57
|
owner_email=email@example.com
|
56
58
|
repo_migrate_status=complete
|
57
59
|
repo_size=
|
58
60
|
requested_stack=
|
59
61
|
slug_size=
|
60
62
|
stack=cedar
|
61
|
-
|
63
|
+
tier=legacy
|
64
|
+
web_url=http://example.herokuapp.com/
|
62
65
|
workers=0
|
63
66
|
STDOUT
|
64
67
|
end
|
@@ -84,40 +87,40 @@ STDOUT
|
|
84
87
|
|
85
88
|
it "with a name" do
|
86
89
|
with_blank_git_repository do
|
87
|
-
stderr, stdout = execute("apps:create
|
90
|
+
stderr, stdout = execute("apps:create example")
|
88
91
|
stderr.should == ""
|
89
92
|
stdout.should == <<-STDOUT
|
90
|
-
Creating
|
91
|
-
http://
|
93
|
+
Creating example... done, stack is bamboo-mri-1.9.2
|
94
|
+
http://example.herokuapp.com/ | git@heroku.com:example.git
|
92
95
|
Git remote heroku added
|
93
96
|
STDOUT
|
94
97
|
end
|
95
|
-
api.delete_app("
|
98
|
+
api.delete_app("example")
|
96
99
|
end
|
97
100
|
|
98
101
|
it "with -a name" do
|
99
102
|
with_blank_git_repository do
|
100
|
-
stderr, stdout = execute("apps:create -a
|
103
|
+
stderr, stdout = execute("apps:create -a example")
|
101
104
|
stderr.should == ""
|
102
105
|
stdout.should == <<-STDOUT
|
103
|
-
Creating
|
104
|
-
http://
|
106
|
+
Creating example... done, stack is bamboo-mri-1.9.2
|
107
|
+
http://example.herokuapp.com/ | git@heroku.com:example.git
|
105
108
|
Git remote heroku added
|
106
109
|
STDOUT
|
107
110
|
end
|
108
|
-
api.delete_app("
|
111
|
+
api.delete_app("example")
|
109
112
|
end
|
110
113
|
|
111
114
|
it "with --no-remote" do
|
112
115
|
with_blank_git_repository do
|
113
|
-
stderr, stdout = execute("apps:create
|
116
|
+
stderr, stdout = execute("apps:create example --no-remote")
|
114
117
|
stderr.should == ""
|
115
118
|
stdout.should == <<-STDOUT
|
116
|
-
Creating
|
117
|
-
http://
|
119
|
+
Creating example... done, stack is bamboo-mri-1.9.2
|
120
|
+
http://example.herokuapp.com/ | git@heroku.com:example.git
|
118
121
|
STDOUT
|
119
122
|
end
|
120
|
-
api.delete_app("
|
123
|
+
api.delete_app("example")
|
121
124
|
end
|
122
125
|
|
123
126
|
it "with addons" do
|
@@ -167,20 +170,20 @@ STDOUT
|
|
167
170
|
context("index") do
|
168
171
|
|
169
172
|
before(:each) do
|
170
|
-
api.post_app("name" => "
|
173
|
+
api.post_app("name" => "example", "stack" => "cedar")
|
171
174
|
end
|
172
175
|
|
173
176
|
after(:each) do
|
174
|
-
api.delete_app("
|
177
|
+
api.delete_app("example")
|
175
178
|
end
|
176
179
|
|
177
180
|
it "succeeds" do
|
178
|
-
stub_core.list.returns([["
|
181
|
+
stub_core.list.returns([["example", "user"]])
|
179
182
|
stderr, stdout = execute("apps")
|
180
183
|
stderr.should == ""
|
181
184
|
stdout.should == <<-STDOUT
|
182
185
|
=== My Apps
|
183
|
-
|
186
|
+
example
|
184
187
|
|
185
188
|
STDOUT
|
186
189
|
end
|
@@ -192,20 +195,20 @@ STDOUT
|
|
192
195
|
context("success") do
|
193
196
|
|
194
197
|
before(:each) do
|
195
|
-
api.post_app("name" => "
|
198
|
+
api.post_app("name" => "example", "stack" => "cedar")
|
196
199
|
end
|
197
200
|
|
198
201
|
after(:each) do
|
199
|
-
api.delete_app("
|
202
|
+
api.delete_app("example2")
|
200
203
|
end
|
201
204
|
|
202
205
|
it "renames app" do
|
203
206
|
with_blank_git_repository do
|
204
|
-
stderr, stdout = execute("apps:rename
|
207
|
+
stderr, stdout = execute("apps:rename example2")
|
205
208
|
stderr.should == ""
|
206
209
|
stdout.should == <<-STDOUT
|
207
|
-
Renaming
|
208
|
-
http://
|
210
|
+
Renaming example to example2... done
|
211
|
+
http://example2.herokuapp.com/ | git@heroku.com:example2.git
|
209
212
|
Don't forget to update your Git remotes on any local checkouts.
|
210
213
|
STDOUT
|
211
214
|
end
|
@@ -227,32 +230,32 @@ STDERR
|
|
227
230
|
context("destroy") do
|
228
231
|
|
229
232
|
before(:each) do
|
230
|
-
api.post_app("name" => "
|
233
|
+
api.post_app("name" => "example", "stack" => "cedar")
|
231
234
|
end
|
232
235
|
|
233
236
|
it "succeeds with app explicitly specified with --app and user confirmation" do
|
234
|
-
stderr, stdout = execute("apps:destroy --confirm
|
237
|
+
stderr, stdout = execute("apps:destroy --confirm example")
|
235
238
|
stderr.should == ""
|
236
239
|
stdout.should == <<-STDOUT
|
237
|
-
Destroying
|
240
|
+
Destroying example (including all add-ons)... done
|
238
241
|
STDOUT
|
239
242
|
end
|
240
243
|
|
241
244
|
context("fails") do
|
242
245
|
|
243
246
|
after(:each) do
|
244
|
-
api.delete_app("
|
247
|
+
api.delete_app("example")
|
245
248
|
end
|
246
249
|
|
247
250
|
it "fails with explicit app but no confirmation" do
|
248
|
-
stderr, stdout = execute("apps:destroy
|
251
|
+
stderr, stdout = execute("apps:destroy example")
|
249
252
|
stderr.should == <<-STDERR
|
250
|
-
! Confirmation did not match
|
253
|
+
! Confirmation did not match example. Aborted.
|
251
254
|
STDERR
|
252
255
|
stdout.should == "
|
253
256
|
! WARNING: Potentially Destructive Action
|
254
|
-
! This command will destroy
|
255
|
-
! To proceed, type \"
|
257
|
+
! This command will destroy example (including all add-ons).
|
258
|
+
! To proceed, type \"example\" or re-run this command with --confirm example
|
256
259
|
|
257
260
|
> "
|
258
261
|
|
@@ -275,73 +278,73 @@ STDERR
|
|
275
278
|
|
276
279
|
it "creates adding heroku to git remote" do
|
277
280
|
with_blank_git_repository do
|
278
|
-
stderr, stdout = execute("apps:create
|
281
|
+
stderr, stdout = execute("apps:create example")
|
279
282
|
stderr.should == ""
|
280
283
|
stdout.should == <<-STDOUT
|
281
|
-
Creating
|
282
|
-
http://
|
284
|
+
Creating example... done, stack is bamboo-mri-1.9.2
|
285
|
+
http://example.herokuapp.com/ | git@heroku.com:example.git
|
283
286
|
Git remote heroku added
|
284
287
|
STDOUT
|
285
288
|
`git remote`.strip.should match(/^heroku$/)
|
286
|
-
api.delete_app("
|
289
|
+
api.delete_app("example")
|
287
290
|
end
|
288
291
|
end
|
289
292
|
|
290
293
|
it "creates adding a custom git remote" do
|
291
294
|
with_blank_git_repository do
|
292
|
-
stderr, stdout = execute("apps:create
|
295
|
+
stderr, stdout = execute("apps:create example --remote myremote")
|
293
296
|
stderr.should == ""
|
294
297
|
stdout.should == <<-STDOUT
|
295
|
-
Creating
|
296
|
-
http://
|
298
|
+
Creating example... done, stack is bamboo-mri-1.9.2
|
299
|
+
http://example.herokuapp.com/ | git@heroku.com:example.git
|
297
300
|
Git remote myremote added
|
298
301
|
STDOUT
|
299
302
|
`git remote`.strip.should match(/^myremote$/)
|
300
|
-
api.delete_app("
|
303
|
+
api.delete_app("example")
|
301
304
|
end
|
302
305
|
end
|
303
306
|
|
304
307
|
it "doesn't add a git remote if it already exists" do
|
305
308
|
with_blank_git_repository do
|
306
309
|
`git remote add heroku /tmp/git_spec_#{Process.pid}`
|
307
|
-
stderr, stdout = execute("apps:create
|
310
|
+
stderr, stdout = execute("apps:create example")
|
308
311
|
stderr.should == ""
|
309
312
|
stdout.should == <<-STDOUT
|
310
|
-
Creating
|
311
|
-
http://
|
313
|
+
Creating example... done, stack is bamboo-mri-1.9.2
|
314
|
+
http://example.herokuapp.com/ | git@heroku.com:example.git
|
312
315
|
STDOUT
|
313
|
-
api.delete_app("
|
316
|
+
api.delete_app("example")
|
314
317
|
end
|
315
318
|
end
|
316
319
|
|
317
320
|
it "renames updating the corresponding heroku git remote" do
|
318
321
|
with_blank_git_repository do
|
319
322
|
`git remote add github git@github.com:test/test.git`
|
320
|
-
`git remote add production git@heroku.com:
|
321
|
-
`git remote add staging git@heroku.com:
|
323
|
+
`git remote add production git@heroku.com:example.git`
|
324
|
+
`git remote add staging git@heroku.com:example-staging.git`
|
322
325
|
|
323
|
-
api.post_app("name" => "
|
324
|
-
stderr, stdout = execute("apps:rename
|
325
|
-
api.delete_app("
|
326
|
+
api.post_app("name" => "example", "stack" => "cedar")
|
327
|
+
stderr, stdout = execute("apps:rename example2")
|
328
|
+
api.delete_app("example2")
|
326
329
|
|
327
330
|
remotes = `git remote -v`
|
328
331
|
remotes.should == <<-REMOTES
|
329
332
|
github\tgit@github.com:test/test.git (fetch)
|
330
333
|
github\tgit@github.com:test/test.git (push)
|
331
|
-
production\tgit@heroku.com:
|
332
|
-
production\tgit@heroku.com:
|
333
|
-
staging\tgit@heroku.com:
|
334
|
-
staging\tgit@heroku.com:
|
334
|
+
production\tgit@heroku.com:example2.git (fetch)
|
335
|
+
production\tgit@heroku.com:example2.git (push)
|
336
|
+
staging\tgit@heroku.com:example-staging.git (fetch)
|
337
|
+
staging\tgit@heroku.com:example-staging.git (push)
|
335
338
|
REMOTES
|
336
339
|
end
|
337
340
|
end
|
338
341
|
|
339
342
|
it "destroys removing any remotes pointing to the app" do
|
340
343
|
with_blank_git_repository do
|
341
|
-
`git remote add heroku git@heroku.com:
|
344
|
+
`git remote add heroku git@heroku.com:example.git`
|
342
345
|
|
343
|
-
api.post_app("name" => "
|
344
|
-
stderr, stdout = execute("apps:destroy --confirm
|
346
|
+
api.post_app("name" => "example", "stack" => "cedar")
|
347
|
+
stderr, stdout = execute("apps:destroy --confirm example")
|
345
348
|
|
346
349
|
`git remote`.strip.should_not include('heroku')
|
347
350
|
end
|