pogo 2.31.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +73 -0
- data/bin/pogo +22 -0
- data/data/cacert.pem +3988 -0
- data/lib/heroku.rb +22 -0
- data/lib/heroku/auth.rb +320 -0
- data/lib/heroku/cli.rb +38 -0
- data/lib/heroku/client.rb +764 -0
- data/lib/heroku/client/heroku_postgresql.rb +111 -0
- data/lib/heroku/client/pgbackups.rb +113 -0
- data/lib/heroku/client/rendezvous.rb +105 -0
- data/lib/heroku/client/ssl_endpoint.rb +25 -0
- data/lib/heroku/command.rb +273 -0
- data/lib/heroku/command/account.rb +23 -0
- data/lib/heroku/command/accounts.rb +34 -0
- data/lib/heroku/command/addons.rb +305 -0
- data/lib/heroku/command/apps.rb +311 -0
- data/lib/heroku/command/auth.rb +86 -0
- data/lib/heroku/command/base.rb +230 -0
- data/lib/heroku/command/certs.rb +148 -0
- data/lib/heroku/command/config.rb +137 -0
- data/lib/heroku/command/db.rb +218 -0
- data/lib/heroku/command/domains.rb +85 -0
- data/lib/heroku/command/drains.rb +46 -0
- data/lib/heroku/command/git.rb +65 -0
- data/lib/heroku/command/help.rb +163 -0
- data/lib/heroku/command/keys.rb +115 -0
- data/lib/heroku/command/labs.rb +161 -0
- data/lib/heroku/command/logs.rb +98 -0
- data/lib/heroku/command/maintenance.rb +61 -0
- data/lib/heroku/command/pg.rb +277 -0
- data/lib/heroku/command/pgbackups.rb +289 -0
- data/lib/heroku/command/plugins.rb +110 -0
- data/lib/heroku/command/ps.rb +232 -0
- data/lib/heroku/command/releases.rb +124 -0
- data/lib/heroku/command/run.rb +179 -0
- data/lib/heroku/command/sharing.rb +89 -0
- data/lib/heroku/command/ssl.rb +61 -0
- data/lib/heroku/command/stack.rb +62 -0
- data/lib/heroku/command/status.rb +51 -0
- data/lib/heroku/command/update.rb +47 -0
- data/lib/heroku/command/version.rb +23 -0
- data/lib/heroku/deprecated.rb +5 -0
- data/lib/heroku/deprecated/help.rb +38 -0
- data/lib/heroku/distribution.rb +9 -0
- data/lib/heroku/helpers.rb +517 -0
- data/lib/heroku/helpers/heroku_postgresql.rb +104 -0
- data/lib/heroku/plugin.rb +161 -0
- data/lib/heroku/updater.rb +158 -0
- data/lib/heroku/version.rb +3 -0
- data/lib/vendor/heroku/okjson.rb +598 -0
- data/spec/helper/legacy_help.rb +16 -0
- data/spec/heroku/auth_spec.rb +246 -0
- data/spec/heroku/client/heroku_postgresql_spec.rb +34 -0
- data/spec/heroku/client/pgbackups_spec.rb +43 -0
- data/spec/heroku/client/rendezvous_spec.rb +62 -0
- data/spec/heroku/client/ssl_endpoint_spec.rb +48 -0
- data/spec/heroku/client_spec.rb +564 -0
- data/spec/heroku/command/addons_spec.rb +585 -0
- data/spec/heroku/command/apps_spec.rb +351 -0
- data/spec/heroku/command/auth_spec.rb +38 -0
- data/spec/heroku/command/base_spec.rb +109 -0
- data/spec/heroku/command/certs_spec.rb +178 -0
- data/spec/heroku/command/config_spec.rb +144 -0
- data/spec/heroku/command/db_spec.rb +110 -0
- data/spec/heroku/command/domains_spec.rb +87 -0
- data/spec/heroku/command/drains_spec.rb +34 -0
- data/spec/heroku/command/git_spec.rb +116 -0
- data/spec/heroku/command/help_spec.rb +93 -0
- data/spec/heroku/command/keys_spec.rb +120 -0
- data/spec/heroku/command/labs_spec.rb +99 -0
- data/spec/heroku/command/logs_spec.rb +60 -0
- data/spec/heroku/command/maintenance_spec.rb +51 -0
- data/spec/heroku/command/pg_spec.rb +223 -0
- data/spec/heroku/command/pgbackups_spec.rb +280 -0
- data/spec/heroku/command/plugins_spec.rb +104 -0
- data/spec/heroku/command/ps_spec.rb +195 -0
- data/spec/heroku/command/releases_spec.rb +130 -0
- data/spec/heroku/command/run_spec.rb +86 -0
- data/spec/heroku/command/sharing_spec.rb +59 -0
- data/spec/heroku/command/ssl_spec.rb +32 -0
- data/spec/heroku/command/stack_spec.rb +46 -0
- data/spec/heroku/command/status_spec.rb +48 -0
- data/spec/heroku/command/version_spec.rb +16 -0
- data/spec/heroku/command_spec.rb +211 -0
- data/spec/heroku/helpers/heroku_postgresql_spec.rb +109 -0
- data/spec/heroku/helpers_spec.rb +48 -0
- data/spec/heroku/plugin_spec.rb +172 -0
- data/spec/heroku/updater_spec.rb +44 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +209 -0
- data/spec/support/display_message_matcher.rb +49 -0
- data/spec/support/openssl_mock_helper.rb +8 -0
- metadata +220 -0
@@ -0,0 +1,104 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "heroku/command/plugins"
|
3
|
+
|
4
|
+
module Heroku::Command
|
5
|
+
include SandboxHelper
|
6
|
+
|
7
|
+
describe Plugins do
|
8
|
+
|
9
|
+
before do
|
10
|
+
@plugin = Heroku::Plugin.new("git://github.com/heroku/Plugin.git")
|
11
|
+
end
|
12
|
+
|
13
|
+
context("install") do
|
14
|
+
|
15
|
+
before do
|
16
|
+
Heroku::Plugin.should_receive(:new).with('git://github.com/heroku/Plugin.git').and_return(@plugin)
|
17
|
+
@plugin.should_receive(:install).and_return(true)
|
18
|
+
end
|
19
|
+
|
20
|
+
it "installs plugins" do
|
21
|
+
Heroku::Plugin.should_receive(:load_plugin).and_return(true)
|
22
|
+
stderr, stdout = execute("plugins:install git://github.com/heroku/Plugin.git")
|
23
|
+
stderr.should == ""
|
24
|
+
stdout.should == <<-STDOUT
|
25
|
+
Installing Plugin... done
|
26
|
+
STDOUT
|
27
|
+
end
|
28
|
+
|
29
|
+
it "does not install plugins that do not load" do
|
30
|
+
Heroku::Plugin.should_receive(:load_plugin).and_return(false)
|
31
|
+
@plugin.should_receive(:uninstall).and_return(true)
|
32
|
+
stderr, stdout = execute("plugins:install git://github.com/heroku/Plugin.git")
|
33
|
+
stderr.should == '' # normally would have error, but mocks/stubs don't allow
|
34
|
+
stdout.should == "Installing Plugin... " # also inaccurate, would end in ' failed'
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
context("uninstall") do
|
40
|
+
|
41
|
+
before do
|
42
|
+
Heroku::Plugin.should_receive(:new).with('Plugin').and_return(@plugin)
|
43
|
+
end
|
44
|
+
|
45
|
+
it "uninstalls plugins" do
|
46
|
+
@plugin.should_receive(:uninstall).and_return(true)
|
47
|
+
stderr, stdout = execute("plugins:uninstall Plugin")
|
48
|
+
stderr.should == ""
|
49
|
+
stdout.should == <<-STDOUT
|
50
|
+
Uninstalling Plugin... done
|
51
|
+
STDOUT
|
52
|
+
end
|
53
|
+
|
54
|
+
it "does not uninstall plugins that do not exist" do
|
55
|
+
stderr, stdout = execute("plugins:uninstall Plugin")
|
56
|
+
stderr.should == <<-STDERR
|
57
|
+
! Plugin plugin not found.
|
58
|
+
STDERR
|
59
|
+
stdout.should == <<-STDOUT
|
60
|
+
Uninstalling Plugin... failed
|
61
|
+
STDOUT
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
|
66
|
+
context("update") do
|
67
|
+
|
68
|
+
before do
|
69
|
+
Heroku::Plugin.should_receive(:new).with('Plugin').and_return(@plugin)
|
70
|
+
end
|
71
|
+
|
72
|
+
it "updates plugin by name" do
|
73
|
+
@plugin.should_receive(:update).and_return(true)
|
74
|
+
stderr, stdout = execute("plugins:update Plugin")
|
75
|
+
stderr.should == ""
|
76
|
+
stdout.should == <<-STDOUT
|
77
|
+
Updating Plugin... done
|
78
|
+
STDOUT
|
79
|
+
end
|
80
|
+
|
81
|
+
it "updates all plugins" do
|
82
|
+
Heroku::Plugin.should_receive(:list).and_return([], [], ['Plugin'])
|
83
|
+
@plugin.should_receive(:update).and_return(true)
|
84
|
+
stderr, stdout = execute("plugins:update")
|
85
|
+
stderr.should == ""
|
86
|
+
stdout.should == <<-STDOUT
|
87
|
+
Updating Plugin... done
|
88
|
+
STDOUT
|
89
|
+
end
|
90
|
+
|
91
|
+
it "does not update plugins that do not exist" do
|
92
|
+
stderr, stdout = execute("plugins:update Plugin")
|
93
|
+
stderr.should == <<-STDERR
|
94
|
+
! Plugin plugin not found.
|
95
|
+
STDERR
|
96
|
+
stdout.should == <<-STDOUT
|
97
|
+
Updating Plugin... failed
|
98
|
+
STDOUT
|
99
|
+
end
|
100
|
+
|
101
|
+
end
|
102
|
+
|
103
|
+
end
|
104
|
+
end
|
@@ -0,0 +1,195 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "heroku/command/ps"
|
3
|
+
|
4
|
+
describe Heroku::Command::Ps do
|
5
|
+
|
6
|
+
before(:each) do
|
7
|
+
stub_core
|
8
|
+
end
|
9
|
+
|
10
|
+
context("cedar") do
|
11
|
+
|
12
|
+
before(:each) do
|
13
|
+
api.post_app("name" => "myapp", "stack" => "cedar")
|
14
|
+
end
|
15
|
+
|
16
|
+
after(:each) do
|
17
|
+
api.delete_app("myapp")
|
18
|
+
end
|
19
|
+
|
20
|
+
it "ps:dynos errors out on cedar apps" do
|
21
|
+
lambda { execute("ps:dynos") }.should raise_error(Heroku::Command::CommandFailed, "For Cedar apps, use `heroku ps`")
|
22
|
+
end
|
23
|
+
|
24
|
+
it "ps:workers errors out on cedar apps" do
|
25
|
+
lambda { execute("ps:workers") }.should raise_error(Heroku::Command::CommandFailed, "For Cedar apps, use `heroku ps`")
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "ps" do
|
29
|
+
|
30
|
+
it "displays processes" do
|
31
|
+
Heroku::Command::Ps.any_instance.should_receive(:time_ago).exactly(10).times.and_return("2012/09/11 12:34:56 (~ 0s ago)")
|
32
|
+
api.post_ps_scale('myapp', 'web', 10)
|
33
|
+
stderr, stdout = execute("ps")
|
34
|
+
stderr.should == ""
|
35
|
+
stdout.should == <<-STDOUT
|
36
|
+
=== web: `bundle exec thin start -p $PORT`
|
37
|
+
web.1: created 2012/09/11 12:34:56 (~ 0s ago)
|
38
|
+
web.2: created 2012/09/11 12:34:56 (~ 0s ago)
|
39
|
+
web.3: created 2012/09/11 12:34:56 (~ 0s ago)
|
40
|
+
web.4: created 2012/09/11 12:34:56 (~ 0s ago)
|
41
|
+
web.5: created 2012/09/11 12:34:56 (~ 0s ago)
|
42
|
+
web.6: created 2012/09/11 12:34:56 (~ 0s ago)
|
43
|
+
web.7: created 2012/09/11 12:34:56 (~ 0s ago)
|
44
|
+
web.8: created 2012/09/11 12:34:56 (~ 0s ago)
|
45
|
+
web.9: created 2012/09/11 12:34:56 (~ 0s ago)
|
46
|
+
web.10: created 2012/09/11 12:34:56 (~ 0s ago)
|
47
|
+
|
48
|
+
STDOUT
|
49
|
+
end
|
50
|
+
|
51
|
+
it "displays one-off processes" do
|
52
|
+
Heroku::Command::Ps.any_instance.should_receive(:time_ago).and_return('2012/09/11 12:34:56 (~ 0s ago)', '2012/09/11 12:34:56 (~ 0s ago)')
|
53
|
+
api.post_ps "myapp", "bash"
|
54
|
+
|
55
|
+
stderr, stdout = execute("ps")
|
56
|
+
stderr.should == ""
|
57
|
+
stdout.should == <<-STDOUT
|
58
|
+
=== run: one-off processes
|
59
|
+
run.1: created 2012/09/11 12:34:56 (~ 0s ago): `bash`
|
60
|
+
|
61
|
+
=== web: `bundle exec thin start -p $PORT`
|
62
|
+
web.1: created 2012/09/11 12:34:56 (~ 0s ago)
|
63
|
+
|
64
|
+
STDOUT
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
describe "ps:restart" do
|
70
|
+
|
71
|
+
it "restarts all processes with no args" do
|
72
|
+
stderr, stdout = execute("ps:restart")
|
73
|
+
stderr.should == ""
|
74
|
+
stdout.should == <<-STDOUT
|
75
|
+
Restarting processes... done
|
76
|
+
STDOUT
|
77
|
+
end
|
78
|
+
|
79
|
+
it "restarts one process" do
|
80
|
+
stderr, stdout = execute("ps:restart web.1")
|
81
|
+
stderr.should == ""
|
82
|
+
stdout.should == <<-STDOUT
|
83
|
+
Restarting web.1 process... done
|
84
|
+
STDOUT
|
85
|
+
end
|
86
|
+
|
87
|
+
it "restarts a type of process" do
|
88
|
+
stderr, stdout = execute("ps:restart web")
|
89
|
+
stderr.should == ""
|
90
|
+
stdout.should == <<-STDOUT
|
91
|
+
Restarting web processes... done
|
92
|
+
STDOUT
|
93
|
+
end
|
94
|
+
|
95
|
+
end
|
96
|
+
|
97
|
+
describe "ps:scale" do
|
98
|
+
|
99
|
+
it "can scale using key/value format" do
|
100
|
+
stderr, stdout = execute("ps:scale web=5")
|
101
|
+
stderr.should == ""
|
102
|
+
stdout.should == <<-STDOUT
|
103
|
+
Scaling web processes... done, now running 5
|
104
|
+
STDOUT
|
105
|
+
end
|
106
|
+
|
107
|
+
it "can scale relative amounts" do
|
108
|
+
stderr, stdout = execute("ps:scale web+2")
|
109
|
+
stderr.should == ""
|
110
|
+
stdout.should == <<-STDOUT
|
111
|
+
Scaling web processes... done, now running 3
|
112
|
+
STDOUT
|
113
|
+
end
|
114
|
+
|
115
|
+
end
|
116
|
+
|
117
|
+
describe "ps:stop" do
|
118
|
+
|
119
|
+
it "restarts one process" do
|
120
|
+
stderr, stdout = execute("ps:restart ps.1")
|
121
|
+
stderr.should == ""
|
122
|
+
stdout.should == <<-STDOUT
|
123
|
+
Restarting ps.1 process... done
|
124
|
+
STDOUT
|
125
|
+
end
|
126
|
+
|
127
|
+
it "restarts a type of process" do
|
128
|
+
stderr, stdout = execute("ps:restart ps")
|
129
|
+
stderr.should == ""
|
130
|
+
stdout.should == <<-STDOUT
|
131
|
+
Restarting ps processes... done
|
132
|
+
STDOUT
|
133
|
+
end
|
134
|
+
|
135
|
+
end
|
136
|
+
|
137
|
+
end
|
138
|
+
|
139
|
+
context("non-cedar") do
|
140
|
+
|
141
|
+
before(:each) do
|
142
|
+
api.post_app("name" => "myapp")
|
143
|
+
end
|
144
|
+
|
145
|
+
after(:each) do
|
146
|
+
api.delete_app("myapp")
|
147
|
+
end
|
148
|
+
|
149
|
+
describe "ps:dynos" do
|
150
|
+
|
151
|
+
it "displays the current number of dynos" do
|
152
|
+
stderr, stdout = execute("ps:dynos")
|
153
|
+
stderr.should == ""
|
154
|
+
stdout.should == <<-STDOUT
|
155
|
+
~ `heroku ps:dynos QTY` has been deprecated and replaced with `heroku ps:scale dynos=QTY`
|
156
|
+
myapp is running 0 dynos
|
157
|
+
STDOUT
|
158
|
+
end
|
159
|
+
|
160
|
+
it "sets the number of dynos" do
|
161
|
+
stderr, stdout = execute("ps:dynos 5")
|
162
|
+
stderr.should == ""
|
163
|
+
stdout.should == <<-STDOUT
|
164
|
+
~ `heroku ps:dynos QTY` has been deprecated and replaced with `heroku ps:scale dynos=QTY`
|
165
|
+
Scaling dynos... done, now running 5
|
166
|
+
STDOUT
|
167
|
+
end
|
168
|
+
|
169
|
+
end
|
170
|
+
|
171
|
+
describe "ps:workers" do
|
172
|
+
|
173
|
+
it "displays the current number of workers" do
|
174
|
+
stderr, stdout = execute("ps:workers")
|
175
|
+
stderr.should == ""
|
176
|
+
stdout.should == <<-STDOUT
|
177
|
+
~ `heroku ps:workers QTY` has been deprecated and replaced with `heroku ps:scale workers=QTY`
|
178
|
+
myapp is running 0 workers
|
179
|
+
STDOUT
|
180
|
+
end
|
181
|
+
|
182
|
+
it "sets the number of workers" do
|
183
|
+
stderr, stdout = execute("ps:workers 5")
|
184
|
+
stderr.should == ""
|
185
|
+
stdout.should == <<-STDOUT
|
186
|
+
~ `heroku ps:workers QTY` has been deprecated and replaced with `heroku ps:scale workers=QTY`
|
187
|
+
Scaling workers... done, now running 5
|
188
|
+
STDOUT
|
189
|
+
end
|
190
|
+
|
191
|
+
end
|
192
|
+
|
193
|
+
end
|
194
|
+
|
195
|
+
end
|
@@ -0,0 +1,130 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "heroku/command/releases"
|
3
|
+
|
4
|
+
describe Heroku::Command::Releases do
|
5
|
+
|
6
|
+
before(:each) do
|
7
|
+
stub_core
|
8
|
+
end
|
9
|
+
|
10
|
+
describe "releases" do
|
11
|
+
|
12
|
+
before(:each) do
|
13
|
+
api.post_app("name" => "myapp", "stack" => "cedar")
|
14
|
+
api.put_config_vars("myapp", { 'FOO_BAR' => 'BAZ' })
|
15
|
+
api.put_config_vars("myapp", { 'BAR_BAZ' => 'QUX' })
|
16
|
+
api.put_config_vars("myapp", { 'BAZ_QUX' => 'QUUX' })
|
17
|
+
api.put_config_vars("myapp", { 'QUX_QUUX' => 'XYZZY' })
|
18
|
+
api.put_config_vars("myapp", { 'SUPER_LONG_CONFIG_VAR_TO_GET_PAST_THE_TRUNCATION_LIMIT' => 'VALUE' })
|
19
|
+
Heroku::Command::Releases.any_instance.should_receive(:time_ago).exactly(5).times.and_return('2012/09/10 11:36:44 (~ 0s ago)', '2012/09/10 11:36:43 (~ 1s ago)', '2012/09/10 11:35:44 (~ 1m ago)', '2012/09/10 10:36:44 (~ 1h ago)', '2012/01/02 12:34:56')
|
20
|
+
end
|
21
|
+
|
22
|
+
after(:each) do
|
23
|
+
api.delete_app("myapp")
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should list releases" do
|
27
|
+
@stderr, @stdout = execute("releases")
|
28
|
+
@stderr.should == ""
|
29
|
+
@stdout.should == <<-STDOUT
|
30
|
+
=== myapp Releases
|
31
|
+
v5 Config add SUPER_LONG_CONFIG_VAR_TO_GE.. email@example.com 2012/09/10 11:36:44 (~ 0s ago)
|
32
|
+
v4 Config add QUX_QUUX email@example.com 2012/09/10 11:36:43 (~ 1s ago)
|
33
|
+
v3 Config add BAZ_QUX email@example.com 2012/09/10 11:35:44 (~ 1m ago)
|
34
|
+
v2 Config add BAR_BAZ email@example.com 2012/09/10 10:36:44 (~ 1h ago)
|
35
|
+
v1 Config add FOO_BAR email@example.com 2012/01/02 12:34:56
|
36
|
+
|
37
|
+
STDOUT
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
describe "releases:info" do
|
43
|
+
before(:each) do
|
44
|
+
api.post_app("name" => "myapp", "stack" => "cedar")
|
45
|
+
api.put_config_vars("myapp", { 'FOO_BAR' => 'BAZ' })
|
46
|
+
end
|
47
|
+
|
48
|
+
after(:each) do
|
49
|
+
api.delete_app("myapp")
|
50
|
+
end
|
51
|
+
|
52
|
+
it "requires a release to be specified" do
|
53
|
+
stderr, stdout = execute("releases:info")
|
54
|
+
stderr.should == <<-STDERR
|
55
|
+
! Usage: heroku releases:info RELEASE
|
56
|
+
STDERR
|
57
|
+
stdout.should == ""
|
58
|
+
end
|
59
|
+
|
60
|
+
it "shows info for a single release" do
|
61
|
+
Heroku::Command::Releases.any_instance.should_receive(:time_ago).and_return("2012/09/11 12:34:56 (~ 0s ago)")
|
62
|
+
stderr, stdout = execute("releases:info v1")
|
63
|
+
stderr.should == ""
|
64
|
+
stdout.should == <<-STDOUT
|
65
|
+
=== Release v1
|
66
|
+
By: email@example.com
|
67
|
+
Change: Config add FOO_BAR
|
68
|
+
When: 2012/09/11 12:34:56 (~ 0s ago)
|
69
|
+
|
70
|
+
=== v1 Config Vars
|
71
|
+
BUNDLE_WITHOUT: development:test
|
72
|
+
DATABASE_URL: postgres://username:password@ec2-123-123-123-123.compute-1.amazonaws.com/username
|
73
|
+
LANG: en_US.UTF-8
|
74
|
+
RACK_ENV: production
|
75
|
+
SHARED_DATABASE_URL: postgres://username:password@ec2-123-123-123-123.compute-1.amazonaws.com/username
|
76
|
+
STDOUT
|
77
|
+
end
|
78
|
+
|
79
|
+
it "shows info for a single release in shell compatible format" do
|
80
|
+
Heroku::Command::Releases.any_instance.should_receive(:time_ago).and_return("2012/09/11 12:34:56 (~ 0s ago)")
|
81
|
+
stderr, stdout = execute("releases:info v1 --shell")
|
82
|
+
stderr.should == ""
|
83
|
+
stdout.should == <<-STDOUT
|
84
|
+
=== Release v1
|
85
|
+
By: email@example.com
|
86
|
+
Change: Config add FOO_BAR
|
87
|
+
When: 2012/09/11 12:34:56 (~ 0s ago)
|
88
|
+
|
89
|
+
=== v1 Config Vars
|
90
|
+
BUNDLE_WITHOUT=development:test
|
91
|
+
DATABASE_URL=postgres://username:password@ec2-123-123-123-123.compute-1.amazonaws.com/username
|
92
|
+
LANG=en_US.UTF-8
|
93
|
+
RACK_ENV=production
|
94
|
+
SHARED_DATABASE_URL=postgres://username:password@ec2-123-123-123-123.compute-1.amazonaws.com/username
|
95
|
+
STDOUT
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
describe "rollback" do
|
100
|
+
before(:each) do
|
101
|
+
api.post_app("name" => "myapp", "stack" => "cedar")
|
102
|
+
api.put_config_vars("myapp", { 'FOO_BAR' => 'BAZ' })
|
103
|
+
api.put_config_vars("myapp", { 'BAR_BAZ' => 'QUX' })
|
104
|
+
api.put_config_vars("myapp", { 'BAZ_QUX' => 'QUUX' })
|
105
|
+
end
|
106
|
+
|
107
|
+
after(:each) do
|
108
|
+
api.delete_app("myapp")
|
109
|
+
end
|
110
|
+
|
111
|
+
it "rolls back to the latest release with no argument" do
|
112
|
+
stderr, stdout = execute("releases:rollback")
|
113
|
+
stderr.should == ""
|
114
|
+
stdout.should == <<-STDOUT
|
115
|
+
Rolling back myapp... done, v2
|
116
|
+
STDOUT
|
117
|
+
end
|
118
|
+
|
119
|
+
it "rolls back to the specified release" do
|
120
|
+
stderr, stdout = execute("releases:rollback v1")
|
121
|
+
stderr.should == ""
|
122
|
+
stdout.should == <<-STDOUT
|
123
|
+
Rolling back myapp... done, v1
|
124
|
+
STDOUT
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
end
|
129
|
+
|
130
|
+
|
@@ -0,0 +1,86 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "heroku/command/run"
|
3
|
+
require "heroku/helpers"
|
4
|
+
|
5
|
+
describe Heroku::Command::Run do
|
6
|
+
|
7
|
+
include Heroku::Helpers
|
8
|
+
|
9
|
+
before(:each) do
|
10
|
+
stub_core
|
11
|
+
api.post_app("name" => "myapp", "stack" => "cedar")
|
12
|
+
end
|
13
|
+
|
14
|
+
after(:each) do
|
15
|
+
api.delete_app("myapp")
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "run" do
|
19
|
+
it "runs a command" do
|
20
|
+
stub_rendezvous.start { $stdout.puts "output" }
|
21
|
+
|
22
|
+
stderr, stdout = execute("run bin/foo")
|
23
|
+
stderr.should == ""
|
24
|
+
stdout.should == <<-STDOUT
|
25
|
+
Running `bin/foo` attached to terminal... up, run.1
|
26
|
+
output
|
27
|
+
STDOUT
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe "run:detached" do
|
32
|
+
it "runs a command detached" do
|
33
|
+
stderr, stdout = execute("run:detached bin/foo")
|
34
|
+
stderr.should == ""
|
35
|
+
stdout.should == <<-STDOUT
|
36
|
+
Running `bin/foo` detached... up, run.1
|
37
|
+
Use `heroku logs -p run.1` to view the output.
|
38
|
+
STDOUT
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe "run:rake" do
|
43
|
+
it "runs a rake command" do
|
44
|
+
stub_rendezvous.start { $stdout.puts("rake_output") }
|
45
|
+
|
46
|
+
stderr, stdout = execute("run:rake foo")
|
47
|
+
stderr.should == ""
|
48
|
+
stdout.should == <<-STDOUT
|
49
|
+
WARNING: `heroku run:rake` has been deprecated. Please use `heroku run rake` instead.
|
50
|
+
Running `rake foo` attached to terminal... up, run.1
|
51
|
+
rake_output
|
52
|
+
STDOUT
|
53
|
+
end
|
54
|
+
|
55
|
+
it "shows the proper command in the deprecation warning" do
|
56
|
+
stub_rendezvous.start { $stdout.puts("rake_output") }
|
57
|
+
|
58
|
+
stderr, stdout = execute("rake foo")
|
59
|
+
stderr.should == ""
|
60
|
+
stdout.should == <<-STDOUT
|
61
|
+
WARNING: `heroku rake` has been deprecated. Please use `heroku run rake` instead.
|
62
|
+
Running `rake foo` attached to terminal... up, run.1
|
63
|
+
rake_output
|
64
|
+
STDOUT
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
describe "run:console" do
|
69
|
+
it "runs a console session" do
|
70
|
+
console = stub(Heroku::Client::ConsoleSession)
|
71
|
+
stub_core.console.returns(console)
|
72
|
+
stderr, stdout = execute("run:console")
|
73
|
+
stderr.should == ""
|
74
|
+
stdout.should == ""
|
75
|
+
end
|
76
|
+
|
77
|
+
it "runs a console command" do
|
78
|
+
stub_core.console("myapp", "bash foo").returns("foo_output")
|
79
|
+
stderr, stdout = execute("run:console bash foo")
|
80
|
+
stderr.should == ""
|
81
|
+
stdout.should == <<-STDOUT
|
82
|
+
foo_output
|
83
|
+
STDOUT
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|