paratrooper 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +5 -0
- data/lib/paratrooper/default_formatter.rb +1 -1
- data/lib/paratrooper/deploy.rb +2 -7
- data/lib/paratrooper/system_caller.rb +1 -1
- data/lib/paratrooper/version.rb +1 -1
- data/spec/paratrooper/deploy_spec.rb +23 -7
- metadata +1 -1
data/Rakefile
CHANGED
data/lib/paratrooper/deploy.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'heroku-api'
|
2
2
|
require 'paratrooper/default_formatter'
|
3
|
+
require 'paratrooper/system_caller'
|
3
4
|
|
4
5
|
module Paratrooper
|
5
6
|
class Deploy
|
@@ -93,17 +94,11 @@ module Paratrooper
|
|
93
94
|
end
|
94
95
|
|
95
96
|
def notify_screen(message)
|
96
|
-
formatter.
|
97
|
+
formatter.display(message)
|
97
98
|
end
|
98
99
|
|
99
100
|
def system_call(call)
|
100
101
|
system_caller.execute(call)
|
101
102
|
end
|
102
103
|
end
|
103
|
-
|
104
|
-
SystemCaller = Struct.new(:call) do
|
105
|
-
def execute
|
106
|
-
system(call)
|
107
|
-
end
|
108
|
-
end
|
109
104
|
end
|
data/lib/paratrooper/version.rb
CHANGED
@@ -59,8 +59,12 @@ describe Paratrooper::Deploy do
|
|
59
59
|
let(:options) { { formatter: formatter } }
|
60
60
|
let(:formatter) { double(:formatter, puts: true) }
|
61
61
|
|
62
|
+
before do
|
63
|
+
formatter.stub(:display)
|
64
|
+
end
|
65
|
+
|
62
66
|
it "displays message" do
|
63
|
-
formatter.should_receive(:
|
67
|
+
formatter.should_receive(:display).with('Activating Maintenance Mode')
|
64
68
|
deployer.activate_maintenance_mode
|
65
69
|
end
|
66
70
|
|
@@ -71,8 +75,12 @@ describe Paratrooper::Deploy do
|
|
71
75
|
end
|
72
76
|
|
73
77
|
describe "#deactivate_maintenance_mode" do
|
78
|
+
before do
|
79
|
+
formatter.stub(:display)
|
80
|
+
end
|
81
|
+
|
74
82
|
it "displays message" do
|
75
|
-
formatter.should_receive(:
|
83
|
+
formatter.should_receive(:display).with('Deactivating Maintenance Mode')
|
76
84
|
deployer.deactivate_maintenance_mode
|
77
85
|
end
|
78
86
|
|
@@ -88,10 +96,11 @@ describe Paratrooper::Deploy do
|
|
88
96
|
|
89
97
|
before do
|
90
98
|
system_caller.stub(:execute)
|
99
|
+
formatter.stub(:display)
|
91
100
|
end
|
92
101
|
|
93
102
|
it 'displays message' do
|
94
|
-
formatter.should_receive(:
|
103
|
+
formatter.should_receive(:display).with('Updating Repo Tag: awesome')
|
95
104
|
deployer.update_repo_tag
|
96
105
|
end
|
97
106
|
|
@@ -119,10 +128,11 @@ describe Paratrooper::Deploy do
|
|
119
128
|
describe "#push_repo" do
|
120
129
|
before do
|
121
130
|
system_caller.stub(:execute)
|
131
|
+
formatter.stub(:display)
|
122
132
|
end
|
123
133
|
|
124
134
|
it 'displays message' do
|
125
|
-
formatter.should_receive(:
|
135
|
+
formatter.should_receive(:display).with('Pushing master to Heroku')
|
126
136
|
deployer.push_repo
|
127
137
|
end
|
128
138
|
|
@@ -136,10 +146,11 @@ describe Paratrooper::Deploy do
|
|
136
146
|
describe "#run_migrations" do
|
137
147
|
before do
|
138
148
|
system_caller.stub(:execute)
|
149
|
+
formatter.stub(:display)
|
139
150
|
end
|
140
151
|
|
141
152
|
it 'displays message' do
|
142
|
-
formatter.should_receive(:
|
153
|
+
formatter.should_receive(:display).with('Running database migrations')
|
143
154
|
deployer.run_migrations
|
144
155
|
end
|
145
156
|
|
@@ -151,8 +162,12 @@ describe Paratrooper::Deploy do
|
|
151
162
|
end
|
152
163
|
|
153
164
|
describe "#app_restart" do
|
165
|
+
before do
|
166
|
+
formatter.stub(:display)
|
167
|
+
end
|
168
|
+
|
154
169
|
it 'displays message' do
|
155
|
-
formatter.should_receive(:
|
170
|
+
formatter.should_receive(:display).with('Restarting application')
|
156
171
|
deployer.app_restart
|
157
172
|
end
|
158
173
|
|
@@ -165,11 +180,12 @@ describe Paratrooper::Deploy do
|
|
165
180
|
describe "#warm_instance" do
|
166
181
|
before do
|
167
182
|
system_caller.stub(:execute)
|
183
|
+
formatter.stub(:display)
|
168
184
|
end
|
169
185
|
|
170
186
|
it 'displays message' do
|
171
187
|
expected_notice = 'Accessing application_url to warm up your application'
|
172
|
-
formatter.should_receive(:
|
188
|
+
formatter.should_receive(:display).with(expected_notice)
|
173
189
|
deployer.warm_instance(0)
|
174
190
|
end
|
175
191
|
|