mr_bump 0.3.3 → 0.3.4

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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YmM5YzE4NTA2NzYzNjZiM2IxZmQ5NGMxMjY2NjgzZDYwOTRiNjc4YQ==
4
+ ZWE5YzJmNjc4YjgwNjRlZTQyNDg4M2Q2ZWMyMDFmYzM2NDdkZDliNA==
5
5
  data.tar.gz: !binary |-
6
- MzJhOTI3ZTgwODgwZThjZDM4MTczYWQxMWIwYWIwMmQ2NDk1OTE1Mg==
6
+ NWJmZWNhMWRmYjA3MGU0YWNkZGViNjVmZThkNDU3NWJmMDdlMGY3Zg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MWY5MDMxMDBiYzM5YWI2ZDJmN2NkZmI5Nzk0YjJjYTAxNmU4MDUxOTk4YjFl
10
- ZDhlZWZkYzliNTc3MjJiNmRjM2U1YmQ2NWJhYjA1ZGI0MTliNTZhNDc4MTZh
11
- NjVkOGYwN2UyZDk1NjU5YzFkMmI3ZDBjNjljZTczOTk1MGY0YmI=
9
+ YzAyNzM0MTMzYjQ0MThlY2ZjNGFlYTVhNmRkOGQ5MTE0NGE0MGQyZTJmMGM5
10
+ ZjM1MmEyNTlmMGQ4MTg3MjA3MjY0YWIxYTM2NTE4M2I5YzRlYjE5OWIzMzM4
11
+ YzVhMGNmZGJmY2Q3ZTI1YzcwM2QzYjkwN2QxYjJkYTQwYTJmZjU=
12
12
  data.tar.gz: !binary |-
13
- MzVlOWZjODRlY2UxZmUxZjk5OGQzOTBhODRhYmZiYTgwMDBhZjkyODdlMTBi
14
- ZWI4NGE1MmZiZjJiMTE0MWEyZTdkYjU5NmMwMGY4YzNmYjBhYmE1MjAzNDJj
15
- OGZhYTljNzhlZDNkZjVkYTg1NWFkYjU5MzQ2NjE0MzIxMjQyMzk=
13
+ ZTVlYjQ3YWQ5ZmU3MDNlZTk4YmVhODhiZTU2MDFhMmZlOWUwNWNmZWNmZmVm
14
+ NDdkMmNjMjBmMmRiNzk2ODg5MGJjMzliYzEzZTA4N2U1YjQzNmU2MzNjMDFm
15
+ ZTQxZjlhZmYxYjMwMmRlMjc5NDViNDZjMzIzMTg5YTY5ZTc4ZjQ=
@@ -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
@@ -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
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.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Fitzgerald