socialcast-git-extensions 3.1.24 → 3.1.25

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 37d095475a120df4785586167bed1e1a02d33ba3
4
- data.tar.gz: 05f528bbf77ff776c39d5055b2308a9e5edb7adb
3
+ metadata.gz: 9bef743036ae096b672baa387db056922567daaa
4
+ data.tar.gz: ed82bd91d889331d71b010786476186f1357ae1c
5
5
  SHA512:
6
- metadata.gz: 611680354aebd1374cbbd6792461a6ee69f2738358db014804587db8af3d55c8f856975b7c91c8581d6a5471d856341bf81c958885044a2dc519e42a9926e014
7
- data.tar.gz: 2169efa6a7ec64c577b96c4dc7f8619ee75f1b12d27db44b4aea995d563252d43653756097e04ab32c3c9dceb83f1c83a94f8485bf294924991b8bf8094c929b
6
+ metadata.gz: 2f89c0952bfd6317142c929fe44786eac10df193955afd945184c80a472f8a2fc7f00d48924ec60a420ea0ebf8e197f7462a779b1901c6da53be1cb400bdc008
7
+ data.tar.gz: 00c83cd3101131844d45b684b59b9e7534ec85a8e59c3ebb48286dd444997293f17f8086295b0e94d2b7702625b2f5095a9afe82657f78df4d07a52150c1c7c6
@@ -20,3 +20,5 @@ specialty_reviewers:
20
20
  base_branch: master
21
21
  staging_branch: staging
22
22
  prototype_branch: prototype
23
+
24
+ enforce_staging_before_release: true
@@ -236,7 +236,10 @@ module Socialcast
236
236
  def release
237
237
  branch = current_branch
238
238
  assert_not_protected_branch!(branch, 'release')
239
- assert_in_last_known_good_staging(branch)
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 = {})
@@ -1,5 +1,5 @@
1
1
  module Socialcast
2
2
  module Gitx
3
- VERSION = "3.1.24"
3
+ VERSION = "3.1.25"
4
4
  end
5
5
  end
@@ -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
- expect_any_instance_of(Socialcast::Gitx::CLI).to receive(:branches).with(:remote => true, :merged => true).and_return(branches_in_last_known_good_staging)
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
- let(:branches_in_last_known_good_staging) { ['another-branch'] }
201
- before do
202
- expect_any_instance_of(Socialcast::Gitx::CLI).not_to receive(:yes?)
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
- it 'prevents the release of the branch' do
205
- 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.')
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: socialcast-git-extensions
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.24
4
+ version: 3.1.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Sonnek