mr_bump 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/bin/mr_bump +8 -2
- metadata +1 -3
- data/spec/mr_bump_spec.rb.orig +0 -626
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
Y2JiNmRmZGY3OWM3YjBlOWI0YzlmOGNlZDkyNGQxZjMwNjhhNWNjOA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NDMwNjIzMTAwOWVmZGZiZDFiZTg3ZGU2ZThmOTkxNDI0ZGEyMDMyMg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YmVlMjAxMTgxNWNjOGIwODFlZjAxNDNjMGE3NGEwZTY2YTcyMDczMTFkNTcy
|
10
|
+
ODQwNzA1MzRjNjM5OWMyNDhjYmI2MGU1MDlkNzEzNzc0NzlkNTlhMGMzOWFk
|
11
|
+
ZTUzNGU5MTFlZmU2N2M3MDJkZWJkNGI0ZDI4OTI1NDNiMmY5ZDk=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MzM1ZGRlMTQ0NDVmNWM0NjJkMDJjMmNhN2I2OTFkNDJmODI4NzcyM2EzNjU3
|
14
|
+
MWQ3Y2NiMTkwMDc0MDFhZWQzODYwNzAzNjg2MzhmNWY3MDk5NzhjYmZlNWE5
|
15
|
+
NmFkZGRiZmU3M2QyMmMzYjc0ZDc0YzI4YTg3N2QzMzhjY2Q4Mzc=
|
data/bin/mr_bump
CHANGED
@@ -23,6 +23,12 @@ def menu(text)
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
+
def editor
|
27
|
+
edit = `git config core.editor`.strip
|
28
|
+
edit = ENV['GIT_EDITOR'] if edit.empty?
|
29
|
+
edit || 'nano'
|
30
|
+
end
|
31
|
+
|
26
32
|
def options
|
27
33
|
@options ||= begin
|
28
34
|
dict = { dryrun: false }
|
@@ -183,7 +189,7 @@ menu '[A]ccept these changes / Manually [E]dit / [C]ancel Release' do |choice|
|
|
183
189
|
tempfile = Tempfile.new('CHANGELOG')
|
184
190
|
tempfile.write(changes)
|
185
191
|
tempfile.close
|
186
|
-
system "
|
192
|
+
system "#{editor} #{tempfile.path}"
|
187
193
|
changes = File.open(tempfile.path, 'r').read.rstrip
|
188
194
|
md_changes = "# #{new_release}\n#{changes}\n\n"
|
189
195
|
puts 'Modified Changelog additions'
|
@@ -202,7 +208,7 @@ end
|
|
202
208
|
if run("git commit -m 'Bump version to #{new_release}' -- #{changelog}") &&
|
203
209
|
run("git tag #{new_release}") &&
|
204
210
|
run('git push && git push --tags') &&
|
205
|
-
(!develop || run("git checkout -b #{new_branch} && git push origin #{new_branch}"))
|
211
|
+
(!develop || run("git checkout -b #{new_branch} && git push --set-upstream origin #{new_branch}"))
|
206
212
|
MrBump.slack_notifier(new_release, changes) unless options[:dryrun]
|
207
213
|
|
208
214
|
branch_type = master ? 'master' : 'release'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mr_bump
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Fitzgerald
|
@@ -185,7 +185,6 @@ files:
|
|
185
185
|
- spec/config_spec.rb
|
186
186
|
- spec/git_config_spec.rb
|
187
187
|
- spec/mr_bump_spec.rb
|
188
|
-
- spec/mr_bump_spec.rb.orig
|
189
188
|
- spec/slack_spec.rb
|
190
189
|
- spec/spec_helper.rb
|
191
190
|
- spec/version_spec.rb
|
@@ -218,7 +217,6 @@ test_files:
|
|
218
217
|
- spec/config_spec.rb
|
219
218
|
- spec/git_config_spec.rb
|
220
219
|
- spec/mr_bump_spec.rb
|
221
|
-
- spec/mr_bump_spec.rb.orig
|
222
220
|
- spec/slack_spec.rb
|
223
221
|
- spec/spec_helper.rb
|
224
222
|
- spec/version_spec.rb
|
data/spec/mr_bump_spec.rb.orig
DELETED
@@ -1,626 +0,0 @@
|
|
1
|
-
# This Source Code Form is subject to the terms of the Mozilla Public
|
2
|
-
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
3
|
-
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
4
|
-
|
5
|
-
require_relative 'spec_helper.rb'
|
6
|
-
require 'mr_bump/version'
|
7
|
-
require 'mr_bump/change'
|
8
|
-
require 'mr_bump'
|
9
|
-
|
10
|
-
describe MrBump do
|
11
|
-
describe '#all_tagged_versions' do
|
12
|
-
before(:each) { allow(MrBump).to receive(:all_tags).and_return(tag_list) }
|
13
|
-
|
14
|
-
context 'when given a mixed list of tags' do
|
15
|
-
let(:tag_list) do
|
16
|
-
[
|
17
|
-
'safbdhasgbd',
|
18
|
-
'',
|
19
|
-
'9.1.32',
|
20
|
-
'21.1',
|
21
|
-
'132',
|
22
|
-
'Not.A Version'
|
23
|
-
]
|
24
|
-
end
|
25
|
-
it 'parses into versions where possible' do
|
26
|
-
expect(MrBump.all_tagged_versions).to match_array(
|
27
|
-
[
|
28
|
-
MrBump::Version.new('9.1.32'),
|
29
|
-
MrBump::Version.new('21.1'),
|
30
|
-
MrBump::Version.new('132')
|
31
|
-
]
|
32
|
-
)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
describe '#current_uat' do
|
38
|
-
before(:each) do
|
39
|
-
allow(MrBump).to receive(:all_tags).and_return(tag_list)
|
40
|
-
allow(MrBump).to receive(:current_uat_major).and_return(MrBump::Version.new(next_version))
|
41
|
-
end
|
42
|
-
|
43
|
-
context 'when the next release is a minor bump' do
|
44
|
-
let(:next_version) { '1.2.0' }
|
45
|
-
let(:tag_list) do
|
46
|
-
[
|
47
|
-
'safbdhasgbd',
|
48
|
-
'',
|
49
|
-
'Not.A Version',
|
50
|
-
'1.2.3',
|
51
|
-
'1.2.2',
|
52
|
-
'1.1.1',
|
53
|
-
'1.1.9'
|
54
|
-
]
|
55
|
-
end
|
56
|
-
it 'returns the maximum tagged version with the same major and minor numbers' do
|
57
|
-
expect(MrBump.current_uat).to eq(MrBump::Version.new('1.2.3'))
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
context 'when the next release is a major bump' do
|
62
|
-
let(:next_version) { '2.0.0' }
|
63
|
-
let(:tag_list) do
|
64
|
-
[
|
65
|
-
'safbdhasgbd',
|
66
|
-
'',
|
67
|
-
'Not.A Version',
|
68
|
-
'1.2.3',
|
69
|
-
'1.2.2',
|
70
|
-
'1.1.1',
|
71
|
-
'1.0.9',
|
72
|
-
'2.0.0',
|
73
|
-
'2.0.1',
|
74
|
-
'2.0.9'
|
75
|
-
]
|
76
|
-
end
|
77
|
-
it 'returns the maximum tagged version with the same major and minor numbers' do
|
78
|
-
expect(MrBump.current_uat).to eq(MrBump::Version.new('2.0.9'))
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
describe '#current_master' do
|
84
|
-
before(:each) do
|
85
|
-
allow(MrBump).to receive(:all_tags).and_return(tag_list)
|
86
|
-
allow(MrBump).to receive(:current_uat_major).and_return(MrBump::Version.new(next_version))
|
87
|
-
end
|
88
|
-
|
89
|
-
context 'when the next release is a minor bump' do
|
90
|
-
let(:next_version) { '1.2.0' }
|
91
|
-
let(:tag_list) do
|
92
|
-
[
|
93
|
-
'safbdhasgbd',
|
94
|
-
'',
|
95
|
-
'Not.A Version',
|
96
|
-
'1.2.3',
|
97
|
-
'1.2.2',
|
98
|
-
'1.1.1',
|
99
|
-
'1.1.9'
|
100
|
-
]
|
101
|
-
end
|
102
|
-
it 'returns the maximum tagged version below the UAT version' do
|
103
|
-
expect(MrBump.current_master).to eq(MrBump::Version.new('1.1.9'))
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
context 'when the next release is a major bump' do
|
108
|
-
let(:next_version) { '2.0.0' }
|
109
|
-
let(:tag_list) do
|
110
|
-
[
|
111
|
-
'safbdhasgbd',
|
112
|
-
'',
|
113
|
-
'Not.A Version',
|
114
|
-
'1.2.3',
|
115
|
-
'1.2.2',
|
116
|
-
'1.1.1',
|
117
|
-
'1.0.9',
|
118
|
-
'2.0.0',
|
119
|
-
'2.0.1',
|
120
|
-
'2.0.9'
|
121
|
-
]
|
122
|
-
end
|
123
|
-
it 'returns the maximum tagged version below the UAT version' do
|
124
|
-
expect(MrBump.current_master).to eq(MrBump::Version.new('1.2.3'))
|
125
|
-
end
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
describe '#latest_release_from_list' do
|
130
|
-
before(:each) { allow(MrBump).to receive(:config_file).and_return(config) }
|
131
|
-
let(:result) { MrBump.latest_release_from_list(branch_list) }
|
132
|
-
let(:config) do
|
133
|
-
{
|
134
|
-
'release_prefix' => "release#{separator}",
|
135
|
-
'release_suffix' => suffix
|
136
|
-
}
|
137
|
-
end
|
138
|
-
let(:suffix) { '' }
|
139
|
-
let(:separator) { '/' }
|
140
|
-
|
141
|
-
context 'With many release branches and using slash separator' do
|
142
|
-
let(:branch_list) do
|
143
|
-
[
|
144
|
-
'origin/release/10.16.0',
|
145
|
-
'origin/release/10.15.9',
|
146
|
-
'origin/release/10.1.0',
|
147
|
-
'origin/release/10.15.0',
|
148
|
-
'origin/rse/10.16.0',
|
149
|
-
'origin/master',
|
150
|
-
''
|
151
|
-
]
|
152
|
-
end
|
153
|
-
|
154
|
-
it 'extracts the highest version' do
|
155
|
-
expect(result).to eq(MrBump::Version.new('10.16.0'))
|
156
|
-
end
|
157
|
-
end
|
158
|
-
|
159
|
-
context 'With a single release branch and using slash separator' do
|
160
|
-
let(:branch_list) do
|
161
|
-
[
|
162
|
-
'origin/release/10.16.9',
|
163
|
-
'origin/rse/1.2.0',
|
164
|
-
'origin/master',
|
165
|
-
''
|
166
|
-
]
|
167
|
-
end
|
168
|
-
|
169
|
-
it 'extracts the version' do
|
170
|
-
expect(result).to eq(MrBump::Version.new('10.16.0'))
|
171
|
-
end
|
172
|
-
end
|
173
|
-
|
174
|
-
context 'With many release branches and minor versions and using slash separator' do
|
175
|
-
let(:branch_list) do
|
176
|
-
[
|
177
|
-
'origin/release/10.16.0',
|
178
|
-
'origin/release/10.15.9',
|
179
|
-
'origin/release/10.1.0',
|
180
|
-
'origin/release/10.15.0',
|
181
|
-
'origin/release/10.16.9',
|
182
|
-
'origin/rse/10.16.0',
|
183
|
-
'origin/master',
|
184
|
-
''
|
185
|
-
]
|
186
|
-
end
|
187
|
-
|
188
|
-
it 'extracts the highest version with patch version set to 0' do
|
189
|
-
expect(result).to eq(MrBump::Version.new('10.16.0'))
|
190
|
-
end
|
191
|
-
end
|
192
|
-
|
193
|
-
context 'With a single release branch with a patch number and using slash separator' do
|
194
|
-
let(:branch_list) do
|
195
|
-
[
|
196
|
-
'origin/release/10.16.9',
|
197
|
-
'origin/rse/1.2.0',
|
198
|
-
'origin/master',
|
199
|
-
''
|
200
|
-
]
|
201
|
-
end
|
202
|
-
|
203
|
-
it 'extracts the version with patch version set to 0' do
|
204
|
-
expect(result).to eq(MrBump::Version.new('10.16.0'))
|
205
|
-
end
|
206
|
-
end
|
207
|
-
|
208
|
-
context 'With no release branches' do
|
209
|
-
let(:branch_list) do
|
210
|
-
[
|
211
|
-
]
|
212
|
-
end
|
213
|
-
|
214
|
-
it 'returns 0.0.0 as the version' do
|
215
|
-
expect(result).to eq(MrBump::Version.new('0.0.0'))
|
216
|
-
end
|
217
|
-
end
|
218
|
-
|
219
|
-
context 'With many release branches and changing the default prefix' do
|
220
|
-
let(:branch_list) do
|
221
|
-
[
|
222
|
-
'origin/release?10.16.0',
|
223
|
-
'origin/release/10.17.0',
|
224
|
-
'origin/release?10.15.9',
|
225
|
-
'origin/release/10.1.0',
|
226
|
-
'origin/release/10.15.0',
|
227
|
-
'origin/rse/10.16.0',
|
228
|
-
'origin/master',
|
229
|
-
''
|
230
|
-
]
|
231
|
-
end
|
232
|
-
let(:separator) { '?' }
|
233
|
-
|
234
|
-
it 'extracts the correct highest version, igoring branches with incorrect prefix' do
|
235
|
-
expect(result).to eq(MrBump::Version.new('10.16.0'))
|
236
|
-
end
|
237
|
-
end
|
238
|
-
|
239
|
-
context 'With many release branches and changing the default suffix' do
|
240
|
-
let(:branch_list) do
|
241
|
-
[
|
242
|
-
'origin/release/10.16.0.',
|
243
|
-
'origin/release/10.17.0.',
|
244
|
-
'origin/release/10.15.9.',
|
245
|
-
'origin/release/10.1.0.',
|
246
|
-
'origin/release/10.15.0',
|
247
|
-
'origin/release/10.18.0',
|
248
|
-
'origin/rse/10.16.0',
|
249
|
-
'origin/master',
|
250
|
-
''
|
251
|
-
]
|
252
|
-
end
|
253
|
-
let(:suffix) { '.' }
|
254
|
-
|
255
|
-
it 'extracts the correct highest version, igoring branches with incorrect suffix' do
|
256
|
-
expect(result).to eq(MrBump::Version.new('10.17.0'))
|
257
|
-
end
|
258
|
-
end
|
259
|
-
|
260
|
-
context 'With many release branches and changing the default prefix' do
|
261
|
-
let(:branch_list) do
|
262
|
-
[
|
263
|
-
'origin/release?10.16.0?',
|
264
|
-
'origin/release/10.17.0?',
|
265
|
-
'origin/release?10.15.9?',
|
266
|
-
'origin/release/10.1.0?',
|
267
|
-
'origin/release/10.15.0?',
|
268
|
-
'origin/release/11.1.0',
|
269
|
-
'origin/release/11.15.0',
|
270
|
-
'origin/release?12.1.0',
|
271
|
-
'origin/release?12.15.0',
|
272
|
-
'origin/rse/10.16.0?',
|
273
|
-
'origin/master',
|
274
|
-
''
|
275
|
-
]
|
276
|
-
end
|
277
|
-
let(:separator) { '?' }
|
278
|
-
let(:suffix) { '?' }
|
279
|
-
|
280
|
-
it 'extracts the correct highest version, igoring branches with incorrect prefix or suffix' do
|
281
|
-
expect(result).to eq(MrBump::Version.new('10.16.0'))
|
282
|
-
end
|
283
|
-
end
|
284
|
-
end
|
285
|
-
|
286
|
-
describe '#on_master_branch?' do
|
287
|
-
before(:each) { allow(MrBump).to receive(:current_branch).and_return(current_branch) }
|
288
|
-
|
289
|
-
context 'when on a branch called master' do
|
290
|
-
let(:current_branch) { 'master' }
|
291
|
-
|
292
|
-
it 'returns true' do
|
293
|
-
expect(MrBump.on_master_branch?).to eq(true)
|
294
|
-
end
|
295
|
-
end
|
296
|
-
|
297
|
-
context 'when on a branch called master$' do
|
298
|
-
let(:current_branch) { 'master$' }
|
299
|
-
|
300
|
-
it 'returns false' do
|
301
|
-
expect(MrBump.on_master_branch?).to eq(false)
|
302
|
-
end
|
303
|
-
end
|
304
|
-
|
305
|
-
context 'when on a branch called ^master' do
|
306
|
-
let(:current_branch) { '^master' }
|
307
|
-
|
308
|
-
it 'returns false' do
|
309
|
-
expect(MrBump.on_master_branch?).to eq(false)
|
310
|
-
end
|
311
|
-
end
|
312
|
-
|
313
|
-
context 'when on a branch called release' do
|
314
|
-
let(:current_branch) { 'release' }
|
315
|
-
|
316
|
-
it 'returns false' do
|
317
|
-
expect(MrBump.on_master_branch?).to eq(false)
|
318
|
-
end
|
319
|
-
end
|
320
|
-
|
321
|
-
context 'when on a branch called develop' do
|
322
|
-
let(:current_branch) { 'develop' }
|
323
|
-
|
324
|
-
it 'returns false' do
|
325
|
-
expect(MrBump.on_master_branch?).to eq(false)
|
326
|
-
end
|
327
|
-
end
|
328
|
-
end
|
329
|
-
|
330
|
-
describe '#on_develop_branch?' do
|
331
|
-
before(:each) { allow(MrBump).to receive(:current_branch).and_return(current_branch) }
|
332
|
-
|
333
|
-
context 'when on a branch called develop' do
|
334
|
-
let(:current_branch) { 'develop' }
|
335
|
-
|
336
|
-
it 'returns true' do
|
337
|
-
expect(MrBump.on_develop_branch?).to eq(true)
|
338
|
-
end
|
339
|
-
end
|
340
|
-
|
341
|
-
context 'when on a branch called develop$' do
|
342
|
-
let(:current_branch) { 'develop$' }
|
343
|
-
|
344
|
-
it 'returns false' do
|
345
|
-
expect(MrBump.on_develop_branch?).to eq(false)
|
346
|
-
end
|
347
|
-
end
|
348
|
-
|
349
|
-
context 'when on a branch called ^develop' do
|
350
|
-
let(:current_branch) { '^develop' }
|
351
|
-
|
352
|
-
it 'returns false' do
|
353
|
-
expect(MrBump.on_develop_branch?).to eq(false)
|
354
|
-
end
|
355
|
-
end
|
356
|
-
|
357
|
-
context 'when on a branch called release' do
|
358
|
-
let(:current_branch) { 'release' }
|
359
|
-
|
360
|
-
it 'returns false' do
|
361
|
-
expect(MrBump.on_develop_branch?).to eq(false)
|
362
|
-
end
|
363
|
-
end
|
364
|
-
|
365
|
-
context 'when on a branch called master' do
|
366
|
-
let(:current_branch) { 'master' }
|
367
|
-
|
368
|
-
it 'returns false' do
|
369
|
-
expect(MrBump.on_develop_branch?).to eq(false)
|
370
|
-
end
|
371
|
-
end
|
372
|
-
end
|
373
|
-
|
374
|
-
describe '#on_release_branch?' do
|
375
|
-
before(:each) { allow(MrBump).to receive(:current_branch).and_return(current_branch) }
|
376
|
-
before(:each) { allow(MrBump).to receive(:config_file).and_return(config) }
|
377
|
-
|
378
|
-
context 'with default config' do
|
379
|
-
let(:config) do
|
380
|
-
{
|
381
|
-
'release_prefix' => 'release/',
|
382
|
-
'release_suffix' => ''
|
383
|
-
}
|
384
|
-
end
|
385
|
-
context 'when on a branch called master' do
|
386
|
-
let(:current_branch) { 'master' }
|
387
|
-
|
388
|
-
it 'returns false' do
|
389
|
-
expect(MrBump.on_release_branch?).to eq(false)
|
390
|
-
end
|
391
|
-
end
|
392
|
-
|
393
|
-
context 'when on a branch called release/' do
|
394
|
-
let(:current_branch) { 'release/' }
|
395
|
-
|
396
|
-
it 'returns false' do
|
397
|
-
expect(MrBump.on_release_branch?).to eq(false)
|
398
|
-
end
|
399
|
-
end
|
400
|
-
|
401
|
-
context 'when on a branch called release/0.0.0' do
|
402
|
-
let(:current_branch) { 'release/0.0.0' }
|
403
|
-
|
404
|
-
it 'returns true' do
|
405
|
-
expect(MrBump.on_release_branch?).to eq(true)
|
406
|
-
end
|
407
|
-
end
|
408
|
-
|
409
|
-
context 'when on a branch called release/0.0' do
|
410
|
-
let(:current_branch) { 'release/0.0' }
|
411
|
-
|
412
|
-
it 'returns true' do
|
413
|
-
expect(MrBump.on_release_branch?).to eq(true)
|
414
|
-
end
|
415
|
-
end
|
416
|
-
|
417
|
-
context 'when on a branch called develop' do
|
418
|
-
let(:current_branch) { 'develop' }
|
419
|
-
|
420
|
-
it 'returns false' do
|
421
|
-
expect(MrBump.on_master_branch?).to eq(false)
|
422
|
-
end
|
423
|
-
end
|
424
|
-
end
|
425
|
-
|
426
|
-
context 'with altered config' do
|
427
|
-
let(:config) do
|
428
|
-
{
|
429
|
-
'release_prefix' => '?v',
|
430
|
-
'release_suffix' => '+'
|
431
|
-
}
|
432
|
-
end
|
433
|
-
|
434
|
-
context 'branch with correct prefix and suffix' do
|
435
|
-
let(:current_branch) { '?v0.0.0+' }
|
436
|
-
|
437
|
-
it 'returns true' do
|
438
|
-
expect(MrBump.on_release_branch?).to eq(true)
|
439
|
-
end
|
440
|
-
end
|
441
|
-
|
442
|
-
context 'branch with correct prefix and suffix and missing patch version' do
|
443
|
-
let(:current_branch) { '?v0.0+' }
|
444
|
-
|
445
|
-
it 'returns true' do
|
446
|
-
expect(MrBump.on_release_branch?).to eq(true)
|
447
|
-
end
|
448
|
-
end
|
449
|
-
|
450
|
-
context 'on a branch which is valid with default config' do
|
451
|
-
let(:current_branch) { 'release/0.0.0' }
|
452
|
-
|
453
|
-
it 'returns false' do
|
454
|
-
expect(MrBump.on_release_branch?).to eq(false)
|
455
|
-
end
|
456
|
-
end
|
457
|
-
end
|
458
|
-
end
|
459
|
-
|
460
|
-
describe '#uat_branch?' do
|
461
|
-
before(:each) do
|
462
|
-
allow(MrBump).to receive(:current_uat_major).and_return(MrBump::Version.new('0.0.0'))
|
463
|
-
end
|
464
|
-
before(:each) { allow(MrBump).to receive(:config_file).and_return(config) }
|
465
|
-
|
466
|
-
context 'with default config' do
|
467
|
-
let(:config) do
|
468
|
-
{
|
469
|
-
'release_prefix' => 'release/',
|
470
|
-
'release_suffix' => ''
|
471
|
-
}
|
472
|
-
end
|
473
|
-
|
474
|
-
it 'correctly constucts uat branch name' do
|
475
|
-
expect(MrBump.uat_branch).to eq('release/0.0.0')
|
476
|
-
end
|
477
|
-
end
|
478
|
-
|
479
|
-
context 'with altered config' do
|
480
|
-
let(:config) do
|
481
|
-
{
|
482
|
-
'release_prefix' => '?v',
|
483
|
-
'release_suffix' => '+'
|
484
|
-
}
|
485
|
-
end
|
486
|
-
|
487
|
-
it 'correctly constucts uat branch name' do
|
488
|
-
expect(MrBump.uat_branch).to eq('?v0.0.0+')
|
489
|
-
end
|
490
|
-
end
|
491
|
-
end
|
492
|
-
|
493
|
-
describe '#change_log_items_for_range' do
|
494
|
-
let(:log) do
|
495
|
-
[
|
496
|
-
'Merge pull request #4 from mr_bump/hotfix/DEV-1261',
|
497
|
-
'Comment',
|
498
|
-
'Merge pull request #1376 from mr_bump/release/10.19.0',
|
499
|
-
'Comment',
|
500
|
-
'Over several',
|
501
|
-
'Lines',
|
502
|
-
'Merge pull request #1365 from mr_bump/revert_contact_fixes',
|
503
|
-
'Merge pull request #1365 from mr_bump/develop',
|
504
|
-
'Merge pull request #233 from mr_bump/bugfix/master',
|
505
|
-
'asdasd',
|
506
|
-
'Merge pull request #1336 from mr_bump/MDV-1261',
|
507
|
-
'wqefqfqefqwefqef'
|
508
|
-
]
|
509
|
-
end
|
510
|
-
before(:each) { allow(MrBump).to receive(:merge_logs).and_return(log) }
|
511
|
-
|
512
|
-
context 'when given output from git log' do
|
513
|
-
let(:changes) { MrBump.change_log_items_for_range('', '') }
|
514
|
-
|
515
|
-
it 'converts raw git log ouput to changlog objects' do
|
516
|
-
expect(changes).to all(be_a(MrBump::Change))
|
517
|
-
end
|
518
|
-
|
519
|
-
it 'filters out release and master branch merges' do
|
520
|
-
expect(changes.map(&:branch_name)).to eq(['DEV-1261', 'revert_contact_fixes', 'MDV-1261'])
|
521
|
-
end
|
522
|
-
end
|
523
|
-
end
|
524
|
-
|
525
|
-
<<<<<<< HEAD
|
526
|
-
describe '#file_prepend' do
|
527
|
-
it 'prepends to files' do
|
528
|
-
file = 'filename.md'
|
529
|
-
before = 'String before'
|
530
|
-
prepend_str = 'Sting to prepend. '
|
531
|
-
after = prepend_str + before
|
532
|
-
|
533
|
-
read_buffer = StringIO.new before
|
534
|
-
write_buffer = StringIO.new
|
535
|
-
|
536
|
-
allow(File).to receive(:open).with(file, 'r').and_yield(read_buffer)
|
537
|
-
allow(File).to receive(:open).with(file, 'w').and_yield(write_buffer)
|
538
|
-
|
539
|
-
MrBump.file_prepend(file, prepend_str)
|
540
|
-
expect(write_buffer.string).to eq(after)
|
541
|
-
=======
|
542
|
-
describe '#last_release' do
|
543
|
-
before do
|
544
|
-
allow(MrBump).to receive(:current_uat).and_return(MrBump::Version.new('0.1.3'))
|
545
|
-
allow(MrBump).to receive(:current_uat_major).and_return(MrBump::Version.new('0.1.0'))
|
546
|
-
allow(MrBump).to receive(:current_master).and_return(MrBump::Version.new('0.0.1'))
|
547
|
-
end
|
548
|
-
|
549
|
-
context 'when on master branch' do
|
550
|
-
before do
|
551
|
-
allow(MrBump).to receive(:on_master_branch?).and_return(true)
|
552
|
-
allow(MrBump).to receive(:on_release_branch?).and_return(false)
|
553
|
-
allow(MrBump).to receive(:on_develop_branch?).and_return(false)
|
554
|
-
end
|
555
|
-
|
556
|
-
it 'returns the master version' do
|
557
|
-
expect(MrBump.last_release).to eq(MrBump::Version.new('0.0.1'))
|
558
|
-
end
|
559
|
-
end
|
560
|
-
context 'when on release branch' do
|
561
|
-
before do
|
562
|
-
allow(MrBump).to receive(:on_master_branch?).and_return(false)
|
563
|
-
allow(MrBump).to receive(:on_release_branch?).and_return(true)
|
564
|
-
allow(MrBump).to receive(:on_develop_branch?).and_return(false)
|
565
|
-
end
|
566
|
-
|
567
|
-
it 'returns the release version' do
|
568
|
-
expect(MrBump.last_release).to eq(MrBump::Version.new('0.1.3'))
|
569
|
-
end
|
570
|
-
end
|
571
|
-
context 'when on develop branch' do
|
572
|
-
before do
|
573
|
-
allow(MrBump).to receive(:on_master_branch?).and_return(false)
|
574
|
-
allow(MrBump).to receive(:on_release_branch?).and_return(false)
|
575
|
-
allow(MrBump).to receive(:on_develop_branch?).and_return(true)
|
576
|
-
end
|
577
|
-
|
578
|
-
it 'returns the last release version' do
|
579
|
-
expect(MrBump.last_release).to eq(MrBump::Version.new('0.1.0'))
|
580
|
-
end
|
581
|
-
end
|
582
|
-
end
|
583
|
-
|
584
|
-
describe '#next_release' do
|
585
|
-
before do
|
586
|
-
allow(MrBump).to receive(:current_uat).and_return(MrBump::Version.new('0.1.3'))
|
587
|
-
allow(MrBump).to receive(:current_uat_major).and_return(MrBump::Version.new('0.1.0'))
|
588
|
-
allow(MrBump).to receive(:current_master).and_return(MrBump::Version.new('0.0.1'))
|
589
|
-
end
|
590
|
-
|
591
|
-
context 'when on master branch' do
|
592
|
-
before do
|
593
|
-
allow(MrBump).to receive(:on_master_branch?).and_return(true)
|
594
|
-
allow(MrBump).to receive(:on_release_branch?).and_return(false)
|
595
|
-
allow(MrBump).to receive(:on_develop_branch?).and_return(false)
|
596
|
-
end
|
597
|
-
|
598
|
-
it 'returns the master version + a patch' do
|
599
|
-
expect(MrBump.next_release).to eq(MrBump::Version.new('0.0.2'))
|
600
|
-
end
|
601
|
-
end
|
602
|
-
context 'when on release branch' do
|
603
|
-
before do
|
604
|
-
allow(MrBump).to receive(:on_master_branch?).and_return(false)
|
605
|
-
allow(MrBump).to receive(:on_release_branch?).and_return(true)
|
606
|
-
allow(MrBump).to receive(:on_develop_branch?).and_return(false)
|
607
|
-
end
|
608
|
-
|
609
|
-
it 'returns the release version' do
|
610
|
-
expect(MrBump.next_release).to eq(MrBump::Version.new('0.1.4'))
|
611
|
-
end
|
612
|
-
end
|
613
|
-
context 'when on develop branch' do
|
614
|
-
before do
|
615
|
-
allow(MrBump).to receive(:on_master_branch?).and_return(false)
|
616
|
-
allow(MrBump).to receive(:on_release_branch?).and_return(false)
|
617
|
-
allow(MrBump).to receive(:on_develop_branch?).and_return(true)
|
618
|
-
end
|
619
|
-
|
620
|
-
it 'returns the release version plus a minor' do
|
621
|
-
expect(MrBump.next_release).to eq(MrBump::Version.new('0.2.0'))
|
622
|
-
end
|
623
|
-
>>>>>>> Allow mr_bump to cut new releases
|
624
|
-
end
|
625
|
-
end
|
626
|
-
end
|