mr_bump 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/mr_bump/change.rb +5 -0
- data/spec/change_spec.rb +72 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZWE5YzJmNjc4YjgwNjRlZTQyNDg4M2Q2ZWMyMDFmYzM2NDdkZDliNA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NWJmZWNhMWRmYjA3MGU0YWNkZGViNjVmZThkNDU3NWJmMDdlMGY3Zg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YzAyNzM0MTMzYjQ0MThlY2ZjNGFlYTVhNmRkOGQ5MTE0NGE0MGQyZTJmMGM5
|
10
|
+
ZjM1MmEyNTlmMGQ4MTg3MjA3MjY0YWIxYTM2NTE4M2I5YzRlYjE5OWIzMzM4
|
11
|
+
YzVhMGNmZGJmY2Q3ZTI1YzcwM2QzYjkwN2QxYjJkYTQwYTJmZjU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZTVlYjQ3YWQ5ZmU3MDNlZTk4YmVhODhiZTU2MDFhMmZlOWUwNWNmZWNmZmVm
|
14
|
+
NDdkMmNjMjBmMmRiNzk2ODg5MGJjMzliYzEzZTA4N2U1YjQzNmU2MzNjMDFm
|
15
|
+
ZTQxZjlhZmYxYjMwMmRlMjc5NDViNDZjMzIzMTg5YTY5ZTc4ZjQ=
|
data/lib/mr_bump/change.rb
CHANGED
@@ -25,6 +25,11 @@ module MrBump
|
|
25
25
|
@dev_id = matches['dev_id'] || 'UNKNOWN'
|
26
26
|
@pr_number = matches['pr_number'] || ''
|
27
27
|
@comment_lines = Array(comment_lines)
|
28
|
+
unless @comment_lines.empty? || @dev_id == 'UNKNOWN'
|
29
|
+
id = Regexp.escape(@dev_id)
|
30
|
+
prefix_regex = /^(\[#{id}\]|\(#{id}\)|#{id})\s*([:\-]\s*)?/
|
31
|
+
@comment_lines[0] = @comment_lines[0].sub(prefix_regex, '')
|
32
|
+
end
|
28
33
|
end
|
29
34
|
|
30
35
|
def first_comment_line
|
data/spec/change_spec.rb
CHANGED
@@ -273,4 +273,76 @@ describe MrBump::Change do
|
|
273
273
|
expect(change.to_md).to eq(" * Task - UNKNOWN - Line 1\n Line 2")
|
274
274
|
end
|
275
275
|
end
|
276
|
+
|
277
|
+
context 'when given a change prefixed with a DevID seperated with a colon' do
|
278
|
+
let(:merge_str) { "Merge branch 'hotfix/DEV-1_Stuff'" }
|
279
|
+
let(:change) { described_class.new(config, merge_str, ['DEV-1: Line 1', 'Line 2']) }
|
280
|
+
|
281
|
+
it 'removes the DevID and renders to markdown correctly' do
|
282
|
+
expect(change.to_md).to eq(" * Hotfix - DEV-1 - Line 1\n Line 2")
|
283
|
+
end
|
284
|
+
end
|
285
|
+
|
286
|
+
context 'when given a change prefixed with a DevID seperated with a dash' do
|
287
|
+
let(:merge_str) { "Merge branch 'hotfix/DEV-1_Stuff'" }
|
288
|
+
let(:change) { described_class.new(config, merge_str, ['DEV-1 - Line 1', 'Line 2']) }
|
289
|
+
|
290
|
+
it 'removes the DevID and renders to markdown correctly' do
|
291
|
+
expect(change.to_md).to eq(" * Hotfix - DEV-1 - Line 1\n Line 2")
|
292
|
+
end
|
293
|
+
end
|
294
|
+
|
295
|
+
context 'when given a change prefixed with a DevID seperated with a dash, and in square braces' do
|
296
|
+
let(:merge_str) { "Merge branch 'hotfix/DEV-1_Stuff'" }
|
297
|
+
let(:change) { described_class.new(config, merge_str, ['[DEV-1] - Line 1', 'Line 2']) }
|
298
|
+
|
299
|
+
it 'removes the DevID and renders to markdown correctly' do
|
300
|
+
expect(change.to_md).to eq(" * Hotfix - DEV-1 - Line 1\n Line 2")
|
301
|
+
end
|
302
|
+
end
|
303
|
+
|
304
|
+
context 'when given a change prefixed with a DevID in square braces' do
|
305
|
+
let(:merge_str) { "Merge branch 'hotfix/DEV-1_Stuff'" }
|
306
|
+
let(:change) { described_class.new(config, merge_str, ['[DEV-1] Line 1', 'Line 2']) }
|
307
|
+
|
308
|
+
it 'removes the DevID and renders to markdown correctly' do
|
309
|
+
expect(change.to_md).to eq(" * Hotfix - DEV-1 - Line 1\n Line 2")
|
310
|
+
end
|
311
|
+
end
|
312
|
+
|
313
|
+
context 'when given a change prefixed with a DevID in round braces' do
|
314
|
+
let(:merge_str) { "Merge branch 'hotfix/DEV-1_Stuff'" }
|
315
|
+
let(:change) { described_class.new(config, merge_str, ['(DEV-1) Line 1', 'Line 2']) }
|
316
|
+
|
317
|
+
it 'removes the DevID and renders to markdown correctly' do
|
318
|
+
expect(change.to_md).to eq(" * Hotfix - DEV-1 - Line 1\n Line 2")
|
319
|
+
end
|
320
|
+
end
|
321
|
+
|
322
|
+
context 'when given a change prefixed with a DevID seperated by space only' do
|
323
|
+
let(:merge_str) { "Merge branch 'hotfix/DEV-1_Stuff'" }
|
324
|
+
let(:change) { described_class.new(config, merge_str, ['DEV-1 Line 1', 'Line 2']) }
|
325
|
+
|
326
|
+
it 'leaves the DevID and renders to markdown correctly' do
|
327
|
+
expect(change.to_md).to eq(" * Hotfix - DEV-1 - Line 1\n Line 2")
|
328
|
+
end
|
329
|
+
end
|
330
|
+
|
331
|
+
context 'when given a change postfixed with a DevID in round braces' do
|
332
|
+
let(:merge_str) { "Merge branch 'hotfix/DEV-1_Stuff'" }
|
333
|
+
let(:change) { described_class.new(config, merge_str, ['Line 1 (DEV-1)', 'Line 2']) }
|
334
|
+
|
335
|
+
it 'leaves the DevID and renders to markdown correctly' do
|
336
|
+
expect(change.to_md).to eq(" * Hotfix - DEV-1 - Line 1 (DEV-1)\n Line 2")
|
337
|
+
end
|
338
|
+
end
|
339
|
+
|
340
|
+
context 'when given a change with no description' do
|
341
|
+
let(:merge_str) { "Merge branch 'hotfix/DEV-1_Stuff'" }
|
342
|
+
let(:change) { described_class.new(config, merge_str, []) }
|
343
|
+
|
344
|
+
it 'renders to markdown correctly' do
|
345
|
+
expect(change.to_md).to eq(" * Hotfix - DEV-1 - ")
|
346
|
+
end
|
347
|
+
end
|
276
348
|
end
|