socialcast-git-extensions 3.1.24 → 3.1.25
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.
- checksums.yaml +4 -4
- data/config/scgitx.yml +2 -0
- data/lib/socialcast-git-extensions/cli.rb +8 -1
- data/lib/socialcast-git-extensions/version.rb +1 -1
- data/spec/cli_spec.rb +37 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9bef743036ae096b672baa387db056922567daaa
|
4
|
+
data.tar.gz: ed82bd91d889331d71b010786476186f1357ae1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f89c0952bfd6317142c929fe44786eac10df193955afd945184c80a472f8a2fc7f00d48924ec60a420ea0ebf8e197f7462a779b1901c6da53be1cb400bdc008
|
7
|
+
data.tar.gz: 00c83cd3101131844d45b684b59b9e7534ec85a8e59c3ebb48286dd444997293f17f8086295b0e94d2b7702625b2f5095a9afe82657f78df4d07a52150c1c7c6
|
data/config/scgitx.yml
CHANGED
@@ -236,7 +236,10 @@ module Socialcast
|
|
236
236
|
def release
|
237
237
|
branch = current_branch
|
238
238
|
assert_not_protected_branch!(branch, 'release')
|
239
|
-
|
239
|
+
|
240
|
+
if enforce_staging_before_release?
|
241
|
+
assert_in_last_known_good_staging(branch)
|
242
|
+
end
|
240
243
|
|
241
244
|
return unless yes?("Release #{branch} to production? (y/n)", :green)
|
242
245
|
|
@@ -262,6 +265,10 @@ module Socialcast
|
|
262
265
|
config['developer_group'] || 'SocialcastDevelopers'
|
263
266
|
end
|
264
267
|
|
268
|
+
def enforce_staging_before_release?
|
269
|
+
!!config['enforce_staging_before_release']
|
270
|
+
end
|
271
|
+
|
265
272
|
# post a message in socialcast
|
266
273
|
# skip sharing message if CLI quiet option is present
|
267
274
|
def post(message, params = {})
|
data/spec/cli_spec.rb
CHANGED
@@ -152,7 +152,8 @@ describe Socialcast::Gitx::CLI do
|
|
152
152
|
describe '#release' do
|
153
153
|
let(:branches_in_last_known_good_staging) { ['FOO'] }
|
154
154
|
before do
|
155
|
-
|
155
|
+
allow_any_instance_of(Socialcast::Gitx::CLI).to receive(:enforce_staging_before_release?).and_return(true)
|
156
|
+
allow_any_instance_of(Socialcast::Gitx::CLI).to receive(:branches).with(:remote => true, :merged => true).and_return(branches_in_last_known_good_staging)
|
156
157
|
end
|
157
158
|
|
158
159
|
context 'when user rejects release' do
|
@@ -197,12 +198,42 @@ describe Socialcast::Gitx::CLI do
|
|
197
198
|
end
|
198
199
|
|
199
200
|
context 'when the branch is not in last_known_good_staging' do
|
200
|
-
|
201
|
-
|
202
|
-
|
201
|
+
context 'and enforce_staging_before_release = true' do
|
202
|
+
let(:branches_in_last_known_good_staging) { ['another-branch'] }
|
203
|
+
before do
|
204
|
+
expect_any_instance_of(Socialcast::Gitx::CLI).to receive(:enforce_staging_before_release?).and_return(true)
|
205
|
+
expect_any_instance_of(Socialcast::Gitx::CLI).not_to receive(:yes?)
|
206
|
+
end
|
207
|
+
it 'prevents the release of the branch' do
|
208
|
+
expect { Socialcast::Gitx::CLI.start ['release'] }.to raise_error(RuntimeError, 'Cannot release FOO unless it has already been promoted separately to staging and the build has passed.')
|
209
|
+
end
|
203
210
|
end
|
204
|
-
|
205
|
-
|
211
|
+
context 'and enforce_staging_before_release = false' do
|
212
|
+
let(:branches_in_last_known_good_staging) { ['another-branch'] }
|
213
|
+
before do
|
214
|
+
stub_message "#worklog releasing FOO to master in socialcast/socialcast-git-extensions #scgitx\n/cc @SocialcastDevelopers"
|
215
|
+
expect_any_instance_of(Socialcast::Gitx::CLI).to receive(:enforce_staging_before_release?).and_return(false)
|
216
|
+
expect_any_instance_of(Socialcast::Gitx::CLI).to receive(:yes?).and_return(true)
|
217
|
+
expect_any_instance_of(Socialcast::Gitx::CLI).to receive(:cleanup)
|
218
|
+
Socialcast::Gitx::CLI.start ['release']
|
219
|
+
end
|
220
|
+
it 'should run expected commands' do
|
221
|
+
expect(Socialcast::Gitx::CLI.stubbed_executed_commands).to eq([
|
222
|
+
"git pull origin FOO",
|
223
|
+
"git pull origin master",
|
224
|
+
"git push origin HEAD",
|
225
|
+
"git checkout master",
|
226
|
+
"git pull origin master",
|
227
|
+
"git pull . FOO",
|
228
|
+
"git push origin HEAD",
|
229
|
+
"git branch -D staging",
|
230
|
+
"git fetch origin",
|
231
|
+
"git checkout staging",
|
232
|
+
"git pull . master",
|
233
|
+
"git push origin HEAD",
|
234
|
+
"git checkout master"
|
235
|
+
])
|
236
|
+
end
|
206
237
|
end
|
207
238
|
end
|
208
239
|
|