pogo 2.31.2 → 2.32.14
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/pogo +5 -4
- data/lib/heroku.rb +6 -11
- data/lib/heroku/auth.rb +22 -5
- data/lib/heroku/client/heroku_postgresql.rb +52 -22
- data/lib/heroku/client/rendezvous.rb +5 -2
- data/lib/heroku/command.rb +42 -21
- data/lib/heroku/command/apps.rb +2 -2
- data/lib/heroku/command/labs.rb +65 -79
- data/lib/heroku/command/pg.rb +55 -66
- data/lib/heroku/command/pgbackups.rb +29 -9
- data/lib/heroku/command/plugins.rb +1 -1
- data/lib/heroku/command/run.rb +3 -1
- data/lib/heroku/command/status.rb +1 -1
- data/lib/heroku/excon.rb +9 -0
- data/lib/heroku/helpers.rb +4 -0
- data/lib/heroku/helpers/heroku_postgresql.rb +110 -56
- data/lib/heroku/updater.rb +70 -66
- data/lib/heroku/version.rb +1 -1
- data/spec/heroku/client/heroku_postgresql_spec.rb +55 -18
- data/spec/heroku/command/addons_spec.rb +18 -2
- data/spec/heroku/command/labs_spec.rb +10 -9
- data/spec/heroku/command/pg_spec.rb +56 -43
- data/spec/heroku/command/pgbackups_spec.rb +28 -6
- data/spec/heroku/command_spec.rb +2 -2
- data/spec/heroku/helpers/heroku_postgresql_spec.rb +65 -47
- metadata +6 -5
@@ -16,8 +16,19 @@ module Heroku::Command
|
|
16
16
|
"PGBACKUPS_URL" => "https://ip:password@pgbackups.heroku.com/client"
|
17
17
|
}
|
18
18
|
)
|
19
|
+
@pgbackups.stub :app_attachments => mock_attachments
|
19
20
|
end
|
20
21
|
|
22
|
+
let(:mock_attachments) {
|
23
|
+
[
|
24
|
+
Heroku::Helpers::HerokuPostgresql::Attachment.new({
|
25
|
+
'config_var' => 'HEROKU_POSTGRESQL_IVORY',
|
26
|
+
'resource' => {'name' => 'softly-mocking-123',
|
27
|
+
'value' => 'postgres://database',
|
28
|
+
'type' => 'heroku-postgresql:baku' }})
|
29
|
+
]
|
30
|
+
}
|
31
|
+
|
21
32
|
after do
|
22
33
|
api.delete_app("myapp")
|
23
34
|
end
|
@@ -42,6 +53,13 @@ STDOUT
|
|
42
53
|
end
|
43
54
|
|
44
55
|
describe "single backup" do
|
56
|
+
let(:from_name) { "FROM_NAME" }
|
57
|
+
let(:from_url) { "postgres://from/bar" }
|
58
|
+
let(:attachment) { double('attachment', :display_name => from_name, :url => from_url ) }
|
59
|
+
before do
|
60
|
+
@pgbackups.stub!(:hpg_resolve).and_return(attachment)
|
61
|
+
end
|
62
|
+
|
45
63
|
it "gets the url for the latest backup if nothing is specified" do
|
46
64
|
stub_core
|
47
65
|
stub_pgbackups.get_latest_backup.returns({"public_url" => "http://latest/backup.dump"})
|
@@ -70,11 +88,9 @@ STDOUT
|
|
70
88
|
end
|
71
89
|
|
72
90
|
it "should capture a backup when requested" do
|
73
|
-
from_name, from_url = "FROM_NAME", "postgres://from/bar"
|
74
91
|
backup_obj = {'to_url' => "s3://bucket/userid/b001.dump"}
|
75
92
|
|
76
93
|
@pgbackups.stub!(:args).and_return([])
|
77
|
-
@pgbackups.stub!(:hpg_resolve).and_return([from_name, from_url])
|
78
94
|
@pgbackups.stub!(:transfer!).with(from_url, from_name, nil, "BACKUP", {:expire => nil}).and_return(backup_obj)
|
79
95
|
@pgbackups.stub!(:poll_transfer!).with(backup_obj).and_return(backup_obj)
|
80
96
|
|
@@ -82,11 +98,9 @@ STDOUT
|
|
82
98
|
end
|
83
99
|
|
84
100
|
it "should send expiration flag to client if specified on args" do
|
85
|
-
from_name, from_url = "FROM_NAME", "postgres://from/bar"
|
86
101
|
backup_obj = {'to_url' => "s3://bucket/userid/b001.dump"}
|
87
102
|
|
88
103
|
@pgbackups.stub!(:options).and_return({:expire => true})
|
89
|
-
@pgbackups.stub!(:hpg_resolve).and_return([from_name, from_url])
|
90
104
|
@pgbackups.stub!(:transfer!).with(from_url, from_name, nil, "BACKUP", {:expire => true}).and_return(backup_obj)
|
91
105
|
@pgbackups.stub!(:poll_transfer!).with(backup_obj).and_return(backup_obj)
|
92
106
|
|
@@ -136,6 +150,12 @@ STDERR
|
|
136
150
|
stub_core
|
137
151
|
stub_pgbackups.create_transfer.returns(@backup_obj)
|
138
152
|
stub_pgbackups.get_transfer.returns(@backup_obj)
|
153
|
+
|
154
|
+
any_instance_of(Heroku::Command::Pgbackups) do |pgbackups|
|
155
|
+
stub(pgbackups).app_attachments.returns(
|
156
|
+
mock_attachments
|
157
|
+
)
|
158
|
+
end
|
139
159
|
end
|
140
160
|
|
141
161
|
it 'aborts on a generic error' do
|
@@ -185,6 +205,7 @@ STDOUT
|
|
185
205
|
end
|
186
206
|
|
187
207
|
context "restore" do
|
208
|
+
let(:attachment) { double('attachment', :display_name => 'someconfigvar', :url => 'postgres://fromhost/database') }
|
188
209
|
before do
|
189
210
|
from_name, from_url = "FROM_NAME", "postgres://fromhost/database"
|
190
211
|
|
@@ -226,12 +247,13 @@ STDOUT
|
|
226
247
|
@pgbackups.restore
|
227
248
|
end
|
228
249
|
|
250
|
+
|
229
251
|
it "should restore the named backup" do
|
230
252
|
name = "backupname"
|
231
253
|
args = ['DATABASE', name]
|
232
254
|
@pgbackups.stub(:args).and_return(args)
|
233
255
|
@pgbackups.stub(:shift_argument).and_return(*args)
|
234
|
-
@pgbackups.stub(:hpg_resolve).and_return(
|
256
|
+
@pgbackups.stub(:hpg_resolve).and_return(attachment)
|
235
257
|
@pgbackups_client.should_receive(:get_backup).with(name).and_return(@backup_obj)
|
236
258
|
@pgbackups.restore
|
237
259
|
end
|
@@ -240,7 +262,7 @@ STDOUT
|
|
240
262
|
args = ['db_name_gets_shifted_out_in_resolve_db', 'http://external/file.dump']
|
241
263
|
@pgbackups.stub(:args).and_return(args)
|
242
264
|
@pgbackups.stub(:shift_argument).and_return(*args)
|
243
|
-
@pgbackups.stub(:hpg_resolve).and_return(
|
265
|
+
@pgbackups.stub(:hpg_resolve).and_return(attachment)
|
244
266
|
@pgbackups_client.should_not_receive(:get_backup)
|
245
267
|
@pgbackups_client.should_not_receive(:get_latest_backup)
|
246
268
|
@pgbackups.restore
|
data/spec/heroku/command_spec.rb
CHANGED
@@ -117,12 +117,12 @@ describe Heroku::Command do
|
|
117
117
|
end
|
118
118
|
|
119
119
|
it "shows Internal Server Error when the response doesn't contain a XML or JSON" do
|
120
|
-
Heroku::Command.extract_error('<h1>HTTP 500</h1>').should == "Internal server error.\nRun
|
120
|
+
Heroku::Command.extract_error('<h1>HTTP 500</h1>').should == "Internal server error.\nRun `heroku status` to check for known platform issues."
|
121
121
|
end
|
122
122
|
|
123
123
|
it "shows Internal Server Error when the response is not plain text" do
|
124
124
|
response = FakeResponse.new(:body => "Foobar", :headers => { :content_type => "application/xml" })
|
125
|
-
Heroku::Command.extract_error(response).should == "Internal server error.\nRun
|
125
|
+
Heroku::Command.extract_error(response).should == "Internal server error.\nRun `heroku status` to check for known platform issues."
|
126
126
|
end
|
127
127
|
|
128
128
|
it "allows a block to redefine the default error" do
|
@@ -6,7 +6,9 @@ include Heroku::Helpers::HerokuPostgresql
|
|
6
6
|
describe Heroku::Helpers::HerokuPostgresql do
|
7
7
|
|
8
8
|
before do
|
9
|
+
subject.forget_config!
|
9
10
|
subject.stub(:app_config_vars) { app_config_vars }
|
11
|
+
subject.stub(:app_attachments) { app_attachments }
|
10
12
|
end
|
11
13
|
|
12
14
|
let(:app_config_vars) do
|
@@ -18,92 +20,108 @@ describe Heroku::Helpers::HerokuPostgresql do
|
|
18
20
|
}
|
19
21
|
end
|
20
22
|
|
23
|
+
let(:app_attachments) {
|
24
|
+
[ Attachment.new({ 'config_var' => 'HEROKU_POSTGRESQL_IVORY_URL',
|
25
|
+
'resource' => {'name' => 'softly-mocking-123',
|
26
|
+
'value' => 'postgres://default',
|
27
|
+
'type' => 'heroku-postgresql:baku' }}),
|
28
|
+
Attachment.new({ 'config_var' => 'HEROKU_POSTGRESQL_BLACK_URL',
|
29
|
+
'resource' => {'name' => 'quickly-yelling-2421',
|
30
|
+
'value' => 'postgres://black',
|
31
|
+
'type' => 'heroku-postgresql:zilla' }})
|
32
|
+
]
|
33
|
+
}
|
34
|
+
|
21
35
|
it "resolves DATABASE" do
|
22
|
-
subject.hpg_resolve('DATABASE')
|
23
|
-
|
24
|
-
|
25
|
-
]
|
36
|
+
att = subject.hpg_resolve('DATABASE')
|
37
|
+
att.display_name.should == "HEROKU_POSTGRESQL_IVORY_URL (DATABASE_URL)"
|
38
|
+
att.url.should == "postgres://default"
|
26
39
|
end
|
27
40
|
|
28
41
|
it "resolves SHARED_DATABASE" do
|
29
|
-
subject.hpg_resolve('SHARED_DATABASE')
|
30
|
-
|
31
|
-
|
32
|
-
]
|
42
|
+
att = subject.hpg_resolve('SHARED_DATABASE')
|
43
|
+
att.display_name.should == "SHARED_DATABASE"
|
44
|
+
att.url.should == "postgres://shared"
|
33
45
|
end
|
34
46
|
|
35
47
|
it "resolves default using NAME" do
|
36
|
-
subject.hpg_resolve(
|
37
|
-
|
38
|
-
|
39
|
-
]
|
48
|
+
att = subject.hpg_resolve('IVORY')
|
49
|
+
att.display_name.should == "HEROKU_POSTGRESQL_IVORY_URL (DATABASE_URL)"
|
50
|
+
att.url.should == "postgres://default"
|
40
51
|
end
|
41
52
|
|
42
53
|
it "resolves non-default using NAME" do
|
43
|
-
subject.hpg_resolve(
|
44
|
-
|
45
|
-
|
46
|
-
]
|
54
|
+
att = subject.hpg_resolve('BLACK')
|
55
|
+
att.display_name.should == "HEROKU_POSTGRESQL_BLACK_URL"
|
56
|
+
att.url.should == "postgres://black"
|
47
57
|
end
|
48
58
|
|
49
59
|
it "resolves default using NAME_URL" do
|
50
|
-
subject.hpg_resolve(
|
51
|
-
|
52
|
-
|
53
|
-
]
|
60
|
+
att = subject.hpg_resolve('IVORY_URL')
|
61
|
+
att.display_name.should == "HEROKU_POSTGRESQL_IVORY_URL (DATABASE_URL)"
|
62
|
+
att.url.should == "postgres://default"
|
54
63
|
end
|
55
64
|
|
56
65
|
it "resolves non-default using NAME_URL" do
|
57
|
-
subject.hpg_resolve(
|
58
|
-
|
59
|
-
|
60
|
-
]
|
66
|
+
att = subject.hpg_resolve('BLACK_URL')
|
67
|
+
att.display_name.should == "HEROKU_POSTGRESQL_BLACK_URL"
|
68
|
+
att.url.should == "postgres://black"
|
61
69
|
end
|
62
70
|
|
63
71
|
it "resolves default using lowercase" do
|
64
|
-
subject.hpg_resolve(
|
65
|
-
|
66
|
-
|
67
|
-
]
|
72
|
+
att = subject.hpg_resolve('ivory')
|
73
|
+
att.display_name.should == "HEROKU_POSTGRESQL_IVORY_URL (DATABASE_URL)"
|
74
|
+
att.url.should == "postgres://default"
|
68
75
|
end
|
69
76
|
|
70
77
|
it "resolves non-default using lowercase" do
|
71
|
-
subject.hpg_resolve(
|
72
|
-
|
73
|
-
|
74
|
-
|
78
|
+
att = subject.hpg_resolve('black')
|
79
|
+
att.display_name.should == "HEROKU_POSTGRESQL_BLACK_URL"
|
80
|
+
att.url.should == "postgres://black"
|
81
|
+
end
|
82
|
+
|
83
|
+
it "resolves non-default using part of name" do
|
84
|
+
att = subject.hpg_resolve('bla')
|
85
|
+
att.display_name.should == "HEROKU_POSTGRESQL_BLACK_URL"
|
86
|
+
att.url.should == "postgres://black"
|
75
87
|
end
|
76
88
|
|
77
89
|
it "throws an error if it doesnt exist" do
|
78
|
-
subject.should_receive(:error).with("Unknown database:
|
90
|
+
subject.should_receive(:error).with("Unknown database: violet. Valid options are: DATABASE_URL, HEROKU_POSTGRESQL_BLACK_URL, HEROKU_POSTGRESQL_IVORY_URL, SHARED_DATABASE")
|
79
91
|
subject.hpg_resolve("violet")
|
80
92
|
end
|
81
93
|
|
82
94
|
context "default" do
|
83
95
|
|
84
96
|
it "errors if there is no default" do
|
85
|
-
subject.should_receive(:error).with("Unknown database. Valid options are:
|
97
|
+
subject.should_receive(:error).with("Unknown database. Valid options are: DATABASE_URL, HEROKU_POSTGRESQL_BLACK_URL, HEROKU_POSTGRESQL_IVORY_URL, SHARED_DATABASE")
|
86
98
|
subject.hpg_resolve(nil)
|
87
99
|
end
|
88
100
|
|
89
|
-
it "uses the default if nothing specified" do
|
90
|
-
subject.hpg_resolve(nil, "DATABASE_URL")
|
91
|
-
|
92
|
-
|
93
|
-
]
|
101
|
+
it "uses the default if nothing(nil) specified" do
|
102
|
+
att = subject.hpg_resolve(nil, "DATABASE_URL")
|
103
|
+
att.display_name.should == "HEROKU_POSTGRESQL_IVORY_URL (DATABASE_URL)"
|
104
|
+
att.url.should == "postgres://default"
|
94
105
|
end
|
95
106
|
|
96
|
-
|
107
|
+
it "uses the default if nothing(empty) specified" do
|
108
|
+
att = subject.hpg_resolve('', "DATABASE_URL")
|
109
|
+
att.display_name.should == "HEROKU_POSTGRESQL_IVORY_URL (DATABASE_URL)"
|
110
|
+
att.url.should == "postgres://default"
|
111
|
+
end
|
97
112
|
|
98
|
-
|
113
|
+
it 'throws an error if given an empty string and asked for the default and there is no default' do
|
114
|
+
app_config_vars.delete 'DATABASE_URL'
|
115
|
+
subject.should_receive(:error).with("Unknown database. Valid options are: HEROKU_POSTGRESQL_BLACK_URL, HEROKU_POSTGRESQL_IVORY_URL, SHARED_DATABASE")
|
116
|
+
att = subject.hpg_resolve('', "DATABASE_URL")
|
117
|
+
end
|
99
118
|
|
100
|
-
it
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
]
|
119
|
+
it 'throws an error if given an empty string and asked for the default and the default doesnt match' do
|
120
|
+
app_config_vars['DATABASE_URL'] = 'something different'
|
121
|
+
subject.should_receive(:error).with("Unknown database. Valid options are: HEROKU_POSTGRESQL_BLACK_URL, HEROKU_POSTGRESQL_IVORY_URL, SHARED_DATABASE")
|
122
|
+
att = subject.hpg_resolve('', "DATABASE_URL")
|
105
123
|
end
|
106
124
|
|
107
|
-
end
|
108
125
|
|
126
|
+
end
|
109
127
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pogo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.32.14
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-10-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: heroku-api
|
@@ -142,6 +142,7 @@ files:
|
|
142
142
|
- lib/heroku/deprecated.rb
|
143
143
|
- lib/heroku/deprecated/help.rb
|
144
144
|
- lib/heroku/distribution.rb
|
145
|
+
- lib/heroku/excon.rb
|
145
146
|
- lib/heroku/helpers.rb
|
146
147
|
- lib/heroku/helpers/heroku_postgresql.rb
|
147
148
|
- lib/heroku/plugin.rb
|
@@ -193,9 +194,9 @@ files:
|
|
193
194
|
homepage: http://pogoapp.com/
|
194
195
|
licenses:
|
195
196
|
- MIT
|
196
|
-
post_install_message: !
|
197
|
-
|
198
|
-
|
197
|
+
post_install_message: ! " ! The `heroku` gem has been deprecated and replaced with
|
198
|
+
the Heroku Toolbelt.\n ! Download and install from: https://toolbelt.heroku.com\n
|
199
|
+
! For API access, see: https://github.com/heroku/heroku.rb\n"
|
199
200
|
rdoc_options: []
|
200
201
|
require_paths:
|
201
202
|
- lib
|