mr_bump 0.3.5 → 0.3.6
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 +8 -8
- data/bin/mr_bump +7 -4
- data/defaults.yml +1 -1
- data/lib/mr_bump.rb +2 -2
- data/lib/mr_bump/change.rb +60 -14
- data/lib/mr_bump/regex_template.rb +57 -0
- data/lib/mr_bump/slack.rb +10 -2
- data/spec/change_spec.rb +437 -175
- data/spec/slack_spec.rb +52 -3
- metadata +32 -5
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NjQ1YzdhMzBhYTY0YTkyMmYwMDM2YzBjNzY5OWZmN2UzZmE1MTU0Yg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NjAzZTRkNGNmOWY0MTg1MTQxZWVjMWI3OTk2NjdmYTZhYzhhOGMzYg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
M2Y3ZDVlM2FlMDk4OTQ4NjEwZjk0OTZiMjhjMzlhN2JkZjIzMGI1NGY1YWM2
|
10
|
+
MjdkODhjZDVkMGY3NmU2OWU4N2ZiYTVjZTJkYzczODBmZDgzMTg2N2VjYTI1
|
11
|
+
ODZmMWJiZDk0OWI3NTliN2Q3NWZhN2ZlMDg3ZjM1ZTRmN2MxNWM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OTg2NmNjNDU4ZDM0MmIwMjk5OWUwZDk4OGNjNjNjMDAzZTY1YTllYjY0NDBh
|
14
|
+
OGYyMGNmNzlkZTI0YmJhYzE4M2FiMzYwZTdjZDY2OGFlYzFmNDYzOTk3Nzlj
|
15
|
+
NjE4NjMwMjQ3YTRjMTNlNjhmMTI2YzZlNTJiNDFiMDE1ODQ1OGY=
|
data/bin/mr_bump
CHANGED
@@ -99,7 +99,7 @@ unless develop
|
|
99
99
|
puts github_client.sorted_prs(MrBump.git_config.path)
|
100
100
|
loop do
|
101
101
|
print 'Enter the PR number to merge : '
|
102
|
-
pr_id = gets.chomp
|
102
|
+
pr_id = STDIN.gets.chomp
|
103
103
|
if options[:dryrun]
|
104
104
|
puts "dryrun: Would merge ##{pr_id}"
|
105
105
|
else
|
@@ -205,10 +205,13 @@ menu '[A]ccept these changes / Manually [E]dit / [C]ancel Release' do |choice|
|
|
205
205
|
MrBump.file_prepend(changelog, md_changes) unless options[:dryrun]
|
206
206
|
end
|
207
207
|
|
208
|
-
|
208
|
+
push_branch_cmd = develop ? "git push --set-upstream origin #{new_branch}" : 'git push'
|
209
|
+
|
210
|
+
if (!develop || run("git checkout -b #{new_branch}")) &&
|
211
|
+
run("git commit -m 'Bump version to #{new_release}' -- #{changelog}") &&
|
209
212
|
run("git tag #{new_release}") &&
|
210
|
-
run(
|
211
|
-
|
213
|
+
run(push_branch_cmd) &&
|
214
|
+
run("git push origin refs/tags/#{new_release}")
|
212
215
|
MrBump.slack_notifier(new_release, changes) unless options[:dryrun]
|
213
216
|
|
214
217
|
branch_type = master ? 'master' : 'release'
|
data/defaults.yml
CHANGED
@@ -24,7 +24,7 @@
|
|
24
24
|
# - comment_lines: Array of all lines in commit comment
|
25
25
|
# - first_commit_line: The first line of the commit comment
|
26
26
|
# - comment_body: The rest of the lines in the comment
|
27
|
-
markdown_template: " * {{branch_type}} - {{dev_id}} - {{first_comment_line}}{{#comment_body}}\n {{.}}{{/comment_body}}"
|
27
|
+
markdown_template: " * {{branch_type}} - {{#dev_id}}{{.}} - {{/dev_id}}{{first_comment_line}}{{#comment_body}}\n {{.}}{{/comment_body}}"
|
28
28
|
|
29
29
|
# Prefix for release branches, this allows arbitrary text to be added before the version number on a release branch
|
30
30
|
release_prefix: release/
|
data/lib/mr_bump.rb
CHANGED
@@ -113,7 +113,7 @@ module MrBump
|
|
113
113
|
def self.change_log_items_for_range(rev, head)
|
114
114
|
ignored_branch = Regexp.new("^(#{release_branch_regex}|master|develop)$")
|
115
115
|
make_change = lambda do |title, comment = []|
|
116
|
-
change = MrBump::Change.
|
116
|
+
change = MrBump::Change.from_gitlog(config_file, title, comment)
|
117
117
|
change unless ignored_branch.match(change.branch_name)
|
118
118
|
end
|
119
119
|
|
@@ -146,7 +146,7 @@ module MrBump
|
|
146
146
|
|
147
147
|
def self.slack_notifier(version, changelog)
|
148
148
|
if config_file.key? 'slack'
|
149
|
-
MrBump::Slack.new(git_config, config_file
|
149
|
+
MrBump::Slack.new(git_config, config_file).bump(version, changelog)
|
150
150
|
end
|
151
151
|
end
|
152
152
|
|
data/lib/mr_bump/change.rb
CHANGED
@@ -3,29 +3,36 @@
|
|
3
3
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
4
4
|
|
5
5
|
require 'mustache'
|
6
|
+
require 'mr_bump/regex_template'
|
6
7
|
|
7
8
|
module MrBump
|
8
9
|
# This class acts parses merge information from a commit message string
|
9
10
|
class Change
|
10
11
|
attr_reader :pr_number, :branch_type, :dev_id, :config, :comment_lines, :branch_name
|
11
12
|
|
12
|
-
|
13
|
-
BRANCH_FMT = "((?<branch_type>bugfix|feature|hotfix)/)?#{BRANCH_NAME_FMT}".freeze
|
14
|
-
MERGE_PR_FMT = "^Merge pull request #(?<pr_number>\\d+) from [\\w\\-_]+/#{BRANCH_FMT}".freeze
|
15
|
-
MERGE_MANUAL_FMT = "^Merge branch '#{BRANCH_FMT}'".freeze
|
16
|
-
MERGE_REGEX = Regexp.new(MERGE_PR_FMT + '|' + MERGE_MANUAL_FMT).freeze
|
13
|
+
BRANCH_TYPES = %w(Bugfix Feature Hotfix Task).freeze
|
17
14
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
15
|
+
FORMATS = {
|
16
|
+
dev_id: '\w+[-_]?\d+',
|
17
|
+
branch_type: "#{BRANCH_TYPES.join('|')}",
|
18
|
+
pr_number: '\d+',
|
19
|
+
first_comment_line: '(?=\w)[^\n]*',
|
20
|
+
comment_body: '(?=\w)[^\n]*'
|
21
|
+
}.freeze
|
22
|
+
|
23
|
+
BRANCH_FMT = "((?<branch_type>#{FORMATS[:branch_type]})/)?(?<branch_name>(?<dev_id>#{FORMATS[:dev_id]})?([\\w\\d\\-_/\\.])*)".freeze
|
24
|
+
MERGE_PR_FMT = "^Merge pull request #(?<pr_number>#{FORMATS[:pr_number]}) from [\\w\\-_]+/#{BRANCH_FMT}/?".freeze
|
25
|
+
MERGE_MANUAL_FMT = "^Merge branch '(#{BRANCH_FMT}/?)'".freeze
|
26
|
+
MERGE_REGEX = Regexp.new(MERGE_PR_FMT + '|' + MERGE_MANUAL_FMT, 'i').freeze
|
27
|
+
|
28
|
+
def initialize(config, branch_type = nil, branch_name = nil, dev_id = nil, pr_number = nil, comment_lines = nil)
|
22
29
|
@config = config
|
23
|
-
@branch_type = (
|
24
|
-
@branch_name =
|
25
|
-
@dev_id =
|
26
|
-
@pr_number =
|
30
|
+
@branch_type = (branch_type || 'Task')
|
31
|
+
@branch_name = branch_name
|
32
|
+
@dev_id = dev_id
|
33
|
+
@pr_number = pr_number || ''
|
27
34
|
@comment_lines = Array(comment_lines)
|
28
|
-
unless @comment_lines.empty? || @dev_id
|
35
|
+
unless @comment_lines.empty? || @dev_id.nil?
|
29
36
|
id = Regexp.escape(@dev_id)
|
30
37
|
prefix_regex = /^(\[#{id}\]|\(#{id}\)|#{id})\s*([:\-]\s*)?/
|
31
38
|
@comment_lines[0] = @comment_lines[0].sub(prefix_regex, '')
|
@@ -43,5 +50,44 @@ module MrBump
|
|
43
50
|
def to_md
|
44
51
|
Mustache.render(config['markdown_template'], self)
|
45
52
|
end
|
53
|
+
|
54
|
+
def self.from_gitlog(config, commit_msg, comment_lines)
|
55
|
+
matches = MERGE_REGEX.match(commit_msg)
|
56
|
+
raise ArgumentError, "Couldn't extract merge information from commit message " \
|
57
|
+
"'#{commit_msg}'" unless matches
|
58
|
+
Change.new(
|
59
|
+
config,
|
60
|
+
(matches['branch_type'] || 'task').capitalize,
|
61
|
+
matches['branch_name'],
|
62
|
+
matches['dev_id'],
|
63
|
+
matches['pr_number'],
|
64
|
+
comment_lines
|
65
|
+
)
|
66
|
+
end
|
67
|
+
|
68
|
+
def self.from_md(config, md)
|
69
|
+
regex = RegexTemplate.render(config['markdown_template'], FORMATS, 'i')
|
70
|
+
matches = regex.match md
|
71
|
+
raise ArgumentError, "Couldn't extract merge information from markdown " \
|
72
|
+
"'#{md}'" unless matches
|
73
|
+
# Convert whole string matches into smaller individual matches
|
74
|
+
match_hash = FORMATS.map do |key, reg|
|
75
|
+
key = key.to_s
|
76
|
+
find = matches.names.include?(key) ? matches[key] : ''
|
77
|
+
[key.to_s, find.scan(Regexp.new(reg)).reject(&:empty?)]
|
78
|
+
end
|
79
|
+
match_hash = Hash[match_hash]
|
80
|
+
|
81
|
+
comment_lines = match_hash['first_comment_line'] + match_hash['comment_body']
|
82
|
+
|
83
|
+
Change.new(
|
84
|
+
config,
|
85
|
+
(match_hash['branch_type'].first || 'task').capitalize,
|
86
|
+
nil,
|
87
|
+
match_hash['dev_id'].first,
|
88
|
+
match_hash['pr_number'].first,
|
89
|
+
comment_lines
|
90
|
+
)
|
91
|
+
end
|
46
92
|
end
|
47
93
|
end
|
@@ -0,0 +1,57 @@
|
|
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
|
+
module MrBump
|
6
|
+
class RegexTemplate < Mustache
|
7
|
+
def render(data = template, ctx = {}, opts = '')
|
8
|
+
Regexp.new(super(data, ctx), opts)
|
9
|
+
end
|
10
|
+
|
11
|
+
class Template < Mustache::Template
|
12
|
+
def compile(src = @source)
|
13
|
+
Generator.new.compile(tokens(src))
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.templateify(obj, _options = {})
|
18
|
+
obj.is_a?(Template) ? obj : Template.new(obj)
|
19
|
+
end
|
20
|
+
|
21
|
+
class Generator < Mustache::Generator
|
22
|
+
def str(s)
|
23
|
+
Regexp.escape(super)
|
24
|
+
end
|
25
|
+
|
26
|
+
def ev(s)
|
27
|
+
"' + (#{s}) + '"
|
28
|
+
end
|
29
|
+
def compile(exp)
|
30
|
+
"'#{compile!(exp)}'"
|
31
|
+
end
|
32
|
+
|
33
|
+
def make_group(names, regex)
|
34
|
+
return regex if names.empty?
|
35
|
+
"(?<#{names.join('.')}>#{regex})"
|
36
|
+
end
|
37
|
+
|
38
|
+
def on_etag(name, _offset)
|
39
|
+
make_group(name[2], ev(compile!(name).to_s))
|
40
|
+
end
|
41
|
+
|
42
|
+
def on_utag(name, _offset)
|
43
|
+
make_group(name[2], ev(compile!(name).to_s))
|
44
|
+
end
|
45
|
+
|
46
|
+
def on_section(name, _offset, content, _raw, _delims)
|
47
|
+
one_repeat = ev("v = #{compile!(name)}; ctx.push(v); r = '#{compile!(content)}'; ctx.pop; r;")
|
48
|
+
make_group(name[2], "(#{one_repeat})*")
|
49
|
+
end
|
50
|
+
|
51
|
+
def on_inverted_section(name, _offset, content, _raw, _delims)
|
52
|
+
one_repeat = ev("v = #{compile!(name)}; ctx.push(v); r = '#{compile!(content)}'; ctx.pop; r;")
|
53
|
+
make_group( name[2], "(#{one_repeat})?")
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
data/lib/mr_bump/slack.rb
CHANGED
@@ -8,12 +8,14 @@ module MrBump
|
|
8
8
|
class Slack
|
9
9
|
attr_accessor :webhook, :username, :jira_url, :icon, :git
|
10
10
|
|
11
|
-
def initialize(git_config,
|
11
|
+
def initialize(git_config, config)
|
12
|
+
opts = config['slack'] || {}
|
12
13
|
raise ArgumentError, 'No Slack webhook found.' unless opts['webhook_url']
|
13
14
|
@webhook = opts['webhook_url']
|
14
15
|
@username = opts['username'] || 'Mr Bump'
|
15
16
|
@jira_url = opts['jira_url']
|
16
17
|
@icon = Array(opts['icon']).sample
|
18
|
+
@config = config
|
17
19
|
@git = git_config
|
18
20
|
end
|
19
21
|
|
@@ -29,7 +31,13 @@ module MrBump
|
|
29
31
|
end
|
30
32
|
|
31
33
|
def jira_ids(changes)
|
32
|
-
changes.split(
|
34
|
+
changes.split(/$\n?(?=\s*\*)/).map do |i|
|
35
|
+
begin
|
36
|
+
MrBump::Change.from_md(@config, i).dev_id
|
37
|
+
rescue ArgumentError
|
38
|
+
nil
|
39
|
+
end
|
40
|
+
end.compact
|
33
41
|
end
|
34
42
|
|
35
43
|
def jira_urls(changes)
|
data/spec/change_spec.rb
CHANGED
@@ -8,275 +8,537 @@ require 'mr_bump/change'
|
|
8
8
|
describe MrBump::Change do
|
9
9
|
let(:config) do
|
10
10
|
{
|
11
|
-
'markdown_template' => ' * {{branch_type}} - {{dev_id}} - {{
|
12
|
-
"{{#comment_body}}\n {{.}}{{/comment_body}}"
|
11
|
+
'markdown_template' => ' * {{branch_type}} - {{#dev_id}}{{.}} - {{/dev_id}}' \
|
12
|
+
"{{first_comment_line}}{{#comment_body}}\n {{.}}{{/comment_body}}"
|
13
13
|
}
|
14
14
|
end
|
15
15
|
|
16
|
-
|
16
|
+
context 'when loading from git log message' do
|
17
|
+
let(:change) { described_class.from_gitlog(config, merge_str, ['Line 1', 'Line 2']) }
|
17
18
|
|
18
|
-
|
19
|
-
|
19
|
+
context 'when given a merge string in the default PR format for a feature' do
|
20
|
+
let(:merge_str) { 'Merge pull request #555 from AGithubUsername/feature/DEV-1_Stuff' }
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
|
22
|
+
it 'extracts the correct PR Number' do
|
23
|
+
expect(change.pr_number).to eq('555')
|
24
|
+
end
|
24
25
|
|
25
|
-
|
26
|
-
|
27
|
-
|
26
|
+
it 'extracts the correct branch type' do
|
27
|
+
expect(change.branch_type).to eq('Feature')
|
28
|
+
end
|
28
29
|
|
29
|
-
|
30
|
-
|
31
|
-
|
30
|
+
it 'extracts the correct dev ID' do
|
31
|
+
expect(change.dev_id).to eq('DEV-1')
|
32
|
+
end
|
32
33
|
|
33
|
-
|
34
|
-
|
34
|
+
it 'renders to markdown correctly' do
|
35
|
+
expect(change.to_md).to eq(" * Feature - DEV-1 - Line 1\n Line 2")
|
36
|
+
end
|
35
37
|
end
|
36
|
-
end
|
37
38
|
|
38
|
-
|
39
|
-
|
39
|
+
context 'when given a merge string in the default PR format for a feature' do
|
40
|
+
let(:merge_str) { 'Merge pull request #555 from AGithubUsername/feature/Stuff' }
|
40
41
|
|
41
|
-
|
42
|
-
|
43
|
-
|
42
|
+
it 'extracts the correct PR Number' do
|
43
|
+
expect(change.pr_number).to eq('555')
|
44
|
+
end
|
44
45
|
|
45
|
-
|
46
|
-
|
47
|
-
|
46
|
+
it 'extracts the correct branch type' do
|
47
|
+
expect(change.branch_type).to eq('Feature')
|
48
|
+
end
|
48
49
|
|
49
|
-
|
50
|
-
|
51
|
-
|
50
|
+
it 'fails to extract dev ID' do
|
51
|
+
expect(change.dev_id).to be_nil
|
52
|
+
end
|
52
53
|
|
53
|
-
|
54
|
-
|
54
|
+
it 'renders to markdown correctly' do
|
55
|
+
expect(change.to_md).to eq(" * Feature - Line 1\n Line 2")
|
56
|
+
end
|
55
57
|
end
|
56
|
-
end
|
57
58
|
|
58
|
-
|
59
|
-
|
59
|
+
context 'when given a merge string in the default PR format for a bugfix' do
|
60
|
+
let(:merge_str) { 'Merge pull request #555 from AGithubUsername/bugfix/DEV-1_Stuff' }
|
60
61
|
|
61
|
-
|
62
|
-
|
63
|
-
|
62
|
+
it 'extracts the correct PR Number' do
|
63
|
+
expect(change.pr_number).to eq('555')
|
64
|
+
end
|
64
65
|
|
65
|
-
|
66
|
-
|
67
|
-
|
66
|
+
it 'extracts the correct branch type' do
|
67
|
+
expect(change.branch_type).to eq('Bugfix')
|
68
|
+
end
|
68
69
|
|
69
|
-
|
70
|
-
|
71
|
-
|
70
|
+
it 'extracts the correct dev ID' do
|
71
|
+
expect(change.dev_id).to eq('DEV-1')
|
72
|
+
end
|
72
73
|
|
73
|
-
|
74
|
-
|
74
|
+
it 'renders to markdown correctly' do
|
75
|
+
expect(change.to_md).to eq(" * Bugfix - DEV-1 - Line 1\n Line 2")
|
76
|
+
end
|
75
77
|
end
|
76
|
-
end
|
77
78
|
|
78
|
-
|
79
|
-
|
79
|
+
context 'when given a merge string in the default PR format for a bugfix' do
|
80
|
+
let(:merge_str) { 'Merge pull request #555 from AGithubUsername/bugfix/Stuff' }
|
80
81
|
|
81
|
-
|
82
|
-
|
83
|
-
|
82
|
+
it 'extracts the correct PR Number' do
|
83
|
+
expect(change.pr_number).to eq('555')
|
84
|
+
end
|
84
85
|
|
85
|
-
|
86
|
-
|
87
|
-
|
86
|
+
it 'extracts the correct branch type' do
|
87
|
+
expect(change.branch_type).to eq('Bugfix')
|
88
|
+
end
|
88
89
|
|
89
|
-
|
90
|
-
|
91
|
-
|
90
|
+
it 'fails to extract dev ID' do
|
91
|
+
expect(change.dev_id).to be_nil
|
92
|
+
end
|
92
93
|
|
93
|
-
|
94
|
-
|
94
|
+
it 'renders to markdown correctly' do
|
95
|
+
expect(change.to_md).to eq(" * Bugfix - Line 1\n Line 2")
|
96
|
+
end
|
95
97
|
end
|
96
|
-
end
|
97
98
|
|
98
|
-
|
99
|
-
|
99
|
+
context 'when given a merge string in the default PR format for a hotfix' do
|
100
|
+
let(:merge_str) { 'Merge pull request #555 from AGithubUsername/hotfix/DEV-1_Stuff' }
|
100
101
|
|
101
|
-
|
102
|
-
|
103
|
-
|
102
|
+
it 'extracts the correct PR Number' do
|
103
|
+
expect(change.pr_number).to eq('555')
|
104
|
+
end
|
104
105
|
|
105
|
-
|
106
|
-
|
107
|
-
|
106
|
+
it 'extracts the correct branch type' do
|
107
|
+
expect(change.branch_type).to eq('Hotfix')
|
108
|
+
end
|
108
109
|
|
109
|
-
|
110
|
-
|
111
|
-
|
110
|
+
it 'extracts the correct dev ID' do
|
111
|
+
expect(change.dev_id).to eq('DEV-1')
|
112
|
+
end
|
112
113
|
|
113
|
-
|
114
|
-
|
114
|
+
it 'renders to markdown correctly' do
|
115
|
+
expect(change.to_md).to eq(" * Hotfix - DEV-1 - Line 1\n Line 2")
|
116
|
+
end
|
115
117
|
end
|
116
|
-
end
|
117
118
|
|
118
|
-
|
119
|
-
|
119
|
+
context 'when given a merge string in the default PR format for a hotfix' do
|
120
|
+
let(:merge_str) { 'Merge pull request #555 from AGithubUsername/hotfix/Stuff' }
|
120
121
|
|
121
|
-
|
122
|
-
|
123
|
-
|
122
|
+
it 'extracts the correct PR Number' do
|
123
|
+
expect(change.pr_number).to eq('555')
|
124
|
+
end
|
124
125
|
|
125
|
-
|
126
|
-
|
127
|
-
|
126
|
+
it 'extracts the correct branch type' do
|
127
|
+
expect(change.branch_type).to eq('Hotfix')
|
128
|
+
end
|
128
129
|
|
129
|
-
|
130
|
-
|
131
|
-
|
130
|
+
it 'fails to extract dev ID' do
|
131
|
+
expect(change.dev_id).to be_nil
|
132
|
+
end
|
132
133
|
|
133
|
-
|
134
|
-
|
134
|
+
it 'renders to markdown correctly' do
|
135
|
+
expect(change.to_md).to eq(" * Hotfix - Line 1\n Line 2")
|
136
|
+
end
|
135
137
|
end
|
136
|
-
end
|
137
138
|
|
138
|
-
|
139
|
-
|
139
|
+
context 'when given a merge string in the default manual format for a feature' do
|
140
|
+
let(:merge_str) { "Merge branch 'feature/DEV-1_Stuff'" }
|
140
141
|
|
141
|
-
|
142
|
-
|
143
|
-
|
142
|
+
it 'defaults PR Number to a blank string' do
|
143
|
+
expect(change.pr_number).to eq('')
|
144
|
+
end
|
144
145
|
|
145
|
-
|
146
|
-
|
147
|
-
|
146
|
+
it 'extracts the correct branch type' do
|
147
|
+
expect(change.branch_type).to eq('Feature')
|
148
|
+
end
|
148
149
|
|
149
|
-
|
150
|
-
|
151
|
-
|
150
|
+
it 'extracts the correct dev ID' do
|
151
|
+
expect(change.dev_id).to eq('DEV-1')
|
152
|
+
end
|
152
153
|
|
153
|
-
|
154
|
-
|
154
|
+
it 'renders to markdown correctly' do
|
155
|
+
expect(change.to_md).to eq(" * Feature - DEV-1 - Line 1\n Line 2")
|
156
|
+
end
|
155
157
|
end
|
156
|
-
end
|
157
158
|
|
158
|
-
|
159
|
-
|
159
|
+
context 'when given a merge string in the default PR format for a feature' do
|
160
|
+
let(:merge_str) { "Merge branch 'feature/Stuff'" }
|
160
161
|
|
161
|
-
|
162
|
-
|
163
|
-
|
162
|
+
it 'defaults PR Number to a blank string' do
|
163
|
+
expect(change.pr_number).to eq('')
|
164
|
+
end
|
164
165
|
|
165
|
-
|
166
|
-
|
167
|
-
|
166
|
+
it 'extracts the correct branch type' do
|
167
|
+
expect(change.branch_type).to eq('Feature')
|
168
|
+
end
|
169
|
+
|
170
|
+
it 'fails to extract dev ID' do
|
171
|
+
expect(change.dev_id).to be_nil
|
172
|
+
end
|
168
173
|
|
169
|
-
|
170
|
-
|
174
|
+
it 'renders to markdown correctly' do
|
175
|
+
expect(change.to_md).to eq(" * Feature - Line 1\n Line 2")
|
176
|
+
end
|
171
177
|
end
|
172
178
|
|
173
|
-
|
174
|
-
|
179
|
+
context 'when given a merge string in the default manual format for a bugfix' do
|
180
|
+
let(:merge_str) { "Merge branch 'bugfix/DEV-1_Stuff'" }
|
181
|
+
|
182
|
+
it 'defaults PR Number to a blank string' do
|
183
|
+
expect(change.pr_number).to eq('')
|
184
|
+
end
|
185
|
+
|
186
|
+
it 'extracts the correct branch type' do
|
187
|
+
expect(change.branch_type).to eq('Bugfix')
|
188
|
+
end
|
189
|
+
|
190
|
+
it 'extracts the correct dev ID' do
|
191
|
+
expect(change.dev_id).to eq('DEV-1')
|
192
|
+
end
|
193
|
+
|
194
|
+
it 'renders to markdown correctly' do
|
195
|
+
expect(change.to_md).to eq(" * Bugfix - DEV-1 - Line 1\n Line 2")
|
196
|
+
end
|
175
197
|
end
|
176
|
-
end
|
177
198
|
|
178
|
-
|
179
|
-
|
199
|
+
context 'when given a merge string in the default PR format for a bugfix' do
|
200
|
+
let(:merge_str) { "Merge branch 'bugfix/Stuff'" }
|
201
|
+
|
202
|
+
it 'defaults PR Number to a blank string' do
|
203
|
+
expect(change.pr_number).to eq('')
|
204
|
+
end
|
205
|
+
|
206
|
+
it 'extracts the correct branch type' do
|
207
|
+
expect(change.branch_type).to eq('Bugfix')
|
208
|
+
end
|
209
|
+
|
210
|
+
it 'fails to extract dev ID' do
|
211
|
+
expect(change.dev_id).to be_nil
|
212
|
+
end
|
180
213
|
|
181
|
-
|
182
|
-
|
214
|
+
it 'renders to markdown correctly' do
|
215
|
+
expect(change.to_md).to eq(" * Bugfix - Line 1\n Line 2")
|
216
|
+
end
|
183
217
|
end
|
184
218
|
|
185
|
-
|
186
|
-
|
219
|
+
context 'when given a merge string in the default manual format for a hotfix' do
|
220
|
+
let(:merge_str) { "Merge branch 'hotfix/DEV-1_Stuff'" }
|
221
|
+
|
222
|
+
it 'defaults PR Number to a blank string' do
|
223
|
+
expect(change.pr_number).to eq('')
|
224
|
+
end
|
225
|
+
|
226
|
+
it 'extracts the correct branch type' do
|
227
|
+
expect(change.branch_type).to eq('Hotfix')
|
228
|
+
end
|
229
|
+
|
230
|
+
it 'extracts the correct dev ID' do
|
231
|
+
expect(change.dev_id).to eq('DEV-1')
|
232
|
+
end
|
233
|
+
|
234
|
+
it 'renders to markdown correctly' do
|
235
|
+
expect(change.to_md).to eq(" * Hotfix - DEV-1 - Line 1\n Line 2")
|
236
|
+
end
|
187
237
|
end
|
188
238
|
|
189
|
-
|
190
|
-
|
239
|
+
context 'when given a merge string in the default PR format for a hotfix' do
|
240
|
+
let(:merge_str) { "Merge branch 'hotfix/Stuff'" }
|
241
|
+
|
242
|
+
it 'defaults PR Number to a blank string' do
|
243
|
+
expect(change.pr_number).to eq('')
|
244
|
+
end
|
245
|
+
|
246
|
+
it 'extracts the correct branch type' do
|
247
|
+
expect(change.branch_type).to eq('Hotfix')
|
248
|
+
end
|
249
|
+
|
250
|
+
it 'fails to extract dev ID' do
|
251
|
+
expect(change.dev_id).to be_nil
|
252
|
+
end
|
253
|
+
|
254
|
+
it 'renders to markdown correctly' do
|
255
|
+
expect(change.to_md).to eq(" * Hotfix - Line 1\n Line 2")
|
256
|
+
end
|
191
257
|
end
|
192
258
|
|
193
|
-
|
194
|
-
|
259
|
+
context 'when no merge type given' do
|
260
|
+
let(:merge_str) { 'Merge pull request #1224 from Xulaus/gem_bump' }
|
261
|
+
it 'extracts the correct PR Number' do
|
262
|
+
expect(change.pr_number).to eq('1224')
|
263
|
+
end
|
264
|
+
|
265
|
+
it 'defaults the branch type to "Task"' do
|
266
|
+
expect(change.branch_type).to eq('Task')
|
267
|
+
end
|
268
|
+
|
269
|
+
it 'fails to extract dev ID' do
|
270
|
+
expect(change.dev_id).to be_nil
|
271
|
+
end
|
272
|
+
|
273
|
+
it 'renders to markdown correctly' do
|
274
|
+
expect(change.to_md).to eq(" * Task - Line 1\n Line 2")
|
275
|
+
end
|
195
276
|
end
|
196
277
|
end
|
197
278
|
|
198
|
-
context 'when
|
199
|
-
let(:
|
279
|
+
context 'when loading from markdown' do
|
280
|
+
let(:change) { described_class.from_md(config, md_str) }
|
281
|
+
|
282
|
+
context 'with bugfix and no DevID given' do
|
283
|
+
let(:md_str) { " * Bugfix - Line 1\n Line 2\n Line 3" }
|
284
|
+
|
285
|
+
it 'extracts the correct branch type' do
|
286
|
+
expect(change.branch_type).to eq('Bugfix')
|
287
|
+
end
|
200
288
|
|
201
|
-
|
202
|
-
|
289
|
+
it 'fails to extract dev ID' do
|
290
|
+
expect(change.dev_id).to be_nil
|
291
|
+
end
|
292
|
+
|
293
|
+
it 'renders to markdown correctly' do
|
294
|
+
expect(change.to_md).to eq(md_str)
|
295
|
+
end
|
203
296
|
end
|
204
297
|
|
205
|
-
|
206
|
-
|
298
|
+
context 'with feature and no DevID given' do
|
299
|
+
let(:md_str) { " * Feature - Line 1\n Line 2\n Line 3" }
|
300
|
+
|
301
|
+
it 'extracts the correct branch type' do
|
302
|
+
expect(change.branch_type).to eq('Feature')
|
303
|
+
end
|
304
|
+
|
305
|
+
it 'fails to extract dev ID' do
|
306
|
+
expect(change.dev_id).to be_nil
|
307
|
+
end
|
308
|
+
|
309
|
+
it 'renders to markdown correctly' do
|
310
|
+
expect(change.to_md).to eq(md_str)
|
311
|
+
end
|
207
312
|
end
|
208
313
|
|
209
|
-
|
210
|
-
|
314
|
+
context 'with hotfix and no DevID given' do
|
315
|
+
let(:md_str) { " * Hotfix - Line 1\n Line 2\n Line 3" }
|
316
|
+
|
317
|
+
it 'extracts the correct branch type' do
|
318
|
+
expect(change.branch_type).to eq('Hotfix')
|
319
|
+
end
|
320
|
+
|
321
|
+
it 'fails to extract dev ID' do
|
322
|
+
expect(change.dev_id).to be_nil
|
323
|
+
end
|
324
|
+
|
325
|
+
it 'renders to markdown correctly' do
|
326
|
+
expect(change.to_md).to eq(md_str)
|
327
|
+
end
|
211
328
|
end
|
212
329
|
|
213
|
-
|
214
|
-
|
330
|
+
context 'with task and no DevID given' do
|
331
|
+
let(:md_str) { " * Task - Line 1\n Line 2\n Line 3" }
|
332
|
+
|
333
|
+
it 'defaults the branch type to "Task"' do
|
334
|
+
expect(change.branch_type).to eq('Task')
|
335
|
+
end
|
336
|
+
|
337
|
+
it 'fails to extract dev ID' do
|
338
|
+
expect(change.dev_id).to be_nil
|
339
|
+
end
|
340
|
+
|
341
|
+
it 'renders to markdown correctly' do
|
342
|
+
expect(change.to_md).to eq(md_str)
|
343
|
+
end
|
215
344
|
end
|
216
|
-
end
|
217
345
|
|
218
|
-
|
219
|
-
|
346
|
+
context 'with bugfix and no DevID given, and no second line' do
|
347
|
+
let(:md_str) { " * Bugfix - Line 1" }
|
348
|
+
|
349
|
+
it 'extracts the correct branch type' do
|
350
|
+
expect(change.branch_type).to eq('Bugfix')
|
351
|
+
end
|
352
|
+
|
353
|
+
it 'fails to extract dev ID' do
|
354
|
+
expect(change.dev_id).to be_nil
|
355
|
+
end
|
220
356
|
|
221
|
-
|
222
|
-
|
357
|
+
it 'renders to markdown correctly' do
|
358
|
+
expect(change.to_md).to eq(md_str)
|
359
|
+
end
|
223
360
|
end
|
224
361
|
|
225
|
-
|
226
|
-
|
362
|
+
context 'with feature and no DevID given, and no second line' do
|
363
|
+
let(:md_str) { " * Feature - Line 1" }
|
364
|
+
|
365
|
+
it 'extracts the correct branch type' do
|
366
|
+
expect(change.branch_type).to eq('Feature')
|
367
|
+
end
|
368
|
+
|
369
|
+
it 'fails to extract dev ID' do
|
370
|
+
expect(change.dev_id).to be_nil
|
371
|
+
end
|
372
|
+
|
373
|
+
it 'renders to markdown correctly' do
|
374
|
+
expect(change.to_md).to eq(md_str)
|
375
|
+
end
|
227
376
|
end
|
228
377
|
|
229
|
-
|
230
|
-
|
378
|
+
context 'with hotfix and no DevID given, and no second line' do
|
379
|
+
let(:md_str) { " * Hotfix - Line 1" }
|
380
|
+
|
381
|
+
it 'extracts the correct branch type' do
|
382
|
+
expect(change.branch_type).to eq('Hotfix')
|
383
|
+
end
|
384
|
+
|
385
|
+
it 'fails to extract dev ID' do
|
386
|
+
expect(change.dev_id).to be_nil
|
387
|
+
end
|
388
|
+
|
389
|
+
it 'renders to markdown correctly' do
|
390
|
+
expect(change.to_md).to eq(md_str)
|
391
|
+
end
|
231
392
|
end
|
232
393
|
|
233
|
-
|
234
|
-
|
394
|
+
context 'with task and no DevID given, and no second line' do
|
395
|
+
let(:md_str) { " * Task - Line 1" }
|
396
|
+
|
397
|
+
it 'defaults the branch type to "Task"' do
|
398
|
+
expect(change.branch_type).to eq('Task')
|
399
|
+
end
|
400
|
+
|
401
|
+
it 'fails to extract dev ID' do
|
402
|
+
expect(change.dev_id).to be_nil
|
403
|
+
end
|
404
|
+
|
405
|
+
it 'renders to markdown correctly' do
|
406
|
+
expect(change.to_md).to eq(md_str)
|
407
|
+
end
|
235
408
|
end
|
236
|
-
end
|
237
409
|
|
238
|
-
|
239
|
-
|
410
|
+
context 'with bugfix and no DevID given' do
|
411
|
+
let(:md_str) { " * Bugfix - ASDASD-123123 - Line 1\n Line 2\n Line 3" }
|
412
|
+
|
413
|
+
it 'extracts the correct branch type' do
|
414
|
+
expect(change.branch_type).to eq('Bugfix')
|
415
|
+
end
|
416
|
+
|
417
|
+
it 'extracts the correct dev ID' do
|
418
|
+
expect(change.dev_id).to eq('ASDASD-123123')
|
419
|
+
end
|
240
420
|
|
241
|
-
|
242
|
-
|
421
|
+
it 'renders to markdown correctly' do
|
422
|
+
expect(change.to_md).to eq(md_str)
|
423
|
+
end
|
243
424
|
end
|
244
425
|
|
245
|
-
|
246
|
-
|
426
|
+
context 'with feature and no DevID given' do
|
427
|
+
let(:md_str) { " * Feature - WHUT00 - Line 1\n Line 2\n Line 3" }
|
428
|
+
|
429
|
+
it 'extracts the correct branch type' do
|
430
|
+
expect(change.branch_type).to eq('Feature')
|
431
|
+
end
|
432
|
+
|
433
|
+
it 'extracts the correct dev ID' do
|
434
|
+
expect(change.dev_id).to eq('WHUT00')
|
435
|
+
end
|
436
|
+
|
437
|
+
it 'renders to markdown correctly' do
|
438
|
+
expect(change.to_md).to eq(md_str)
|
439
|
+
end
|
247
440
|
end
|
248
441
|
|
249
|
-
|
250
|
-
|
442
|
+
context 'with hotfix and no DevID given' do
|
443
|
+
let(:md_str) { " * Hotfix - WJNASD-123 - Line 1\n Line 2\n Line 3" }
|
444
|
+
|
445
|
+
it 'extracts the correct branch type' do
|
446
|
+
expect(change.branch_type).to eq('Hotfix')
|
447
|
+
end
|
448
|
+
|
449
|
+
it 'extracts the correct dev ID' do
|
450
|
+
expect(change.dev_id).to eq('WJNASD-123')
|
451
|
+
end
|
452
|
+
|
453
|
+
it 'renders to markdown correctly' do
|
454
|
+
expect(change.to_md).to eq(md_str)
|
455
|
+
end
|
251
456
|
end
|
252
457
|
|
253
|
-
|
254
|
-
|
458
|
+
context 'with task and no DevID given' do
|
459
|
+
let(:md_str) { " * Task - lqiwhuweh213 - Line 1\n Line 2\n Line 3" }
|
460
|
+
|
461
|
+
it 'defaults the branch type to "Task"' do
|
462
|
+
expect(change.branch_type).to eq('Task')
|
463
|
+
end
|
464
|
+
|
465
|
+
it 'extracts the correct dev ID' do
|
466
|
+
expect(change.dev_id).to eq('lqiwhuweh213')
|
467
|
+
end
|
468
|
+
|
469
|
+
it 'renders to markdown correctly' do
|
470
|
+
expect(change.to_md).to eq(md_str)
|
471
|
+
end
|
255
472
|
end
|
256
|
-
end
|
257
473
|
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
474
|
+
context 'with bugfix and no DevID given, and no second line' do
|
475
|
+
let(:md_str) { " * Bugfix - DEV-123 - Line 1" }
|
476
|
+
|
477
|
+
it 'extracts the correct branch type' do
|
478
|
+
expect(change.branch_type).to eq('Bugfix')
|
479
|
+
end
|
480
|
+
|
481
|
+
it 'extracts the correct dev ID' do
|
482
|
+
expect(change.dev_id).to eq('DEV-123')
|
483
|
+
end
|
484
|
+
|
485
|
+
it 'renders to markdown correctly' do
|
486
|
+
expect(change.to_md).to eq(md_str)
|
487
|
+
end
|
262
488
|
end
|
263
489
|
|
264
|
-
|
265
|
-
|
490
|
+
context 'with feature and no DevID given, and no second line' do
|
491
|
+
let(:md_str) { " * Feature - SAMBA-123 - Line 1" }
|
492
|
+
|
493
|
+
it 'extracts the correct branch type' do
|
494
|
+
expect(change.branch_type).to eq('Feature')
|
495
|
+
end
|
496
|
+
|
497
|
+
it 'extracts the correct dev ID' do
|
498
|
+
expect(change.dev_id).to eq('SAMBA-123')
|
499
|
+
end
|
500
|
+
|
501
|
+
it 'renders to markdown correctly' do
|
502
|
+
expect(change.to_md).to eq(md_str)
|
503
|
+
end
|
266
504
|
end
|
267
505
|
|
268
|
-
|
269
|
-
|
506
|
+
context 'with hotfix and no DevID given, and no second line' do
|
507
|
+
let(:md_str) { " * Hotfix - asf1 - Line 1" }
|
508
|
+
|
509
|
+
it 'extracts the correct branch type' do
|
510
|
+
expect(change.branch_type).to eq('Hotfix')
|
511
|
+
end
|
512
|
+
|
513
|
+
it 'extracts the correct dev ID' do
|
514
|
+
expect(change.dev_id).to eq('asf1')
|
515
|
+
end
|
516
|
+
|
517
|
+
it 'renders to markdown correctly' do
|
518
|
+
expect(change.to_md).to eq(md_str)
|
519
|
+
end
|
270
520
|
end
|
271
521
|
|
272
|
-
|
273
|
-
|
522
|
+
context 'with task and no DevID given, and no second line' do
|
523
|
+
let(:md_str) { " * Task - JBAJSDB0123 - Line 1" }
|
524
|
+
|
525
|
+
it 'defaults the branch type to "Task"' do
|
526
|
+
expect(change.branch_type).to eq('Task')
|
527
|
+
end
|
528
|
+
|
529
|
+
it 'extracts the correct dev ID' do
|
530
|
+
expect(change.dev_id).to eq('JBAJSDB0123')
|
531
|
+
end
|
532
|
+
|
533
|
+
it 'renders to markdown correctly' do
|
534
|
+
expect(change.to_md).to eq(md_str)
|
535
|
+
end
|
274
536
|
end
|
275
537
|
end
|
276
538
|
|
277
539
|
context 'when given a change prefixed with a DevID seperated with a colon' do
|
278
540
|
let(:merge_str) { "Merge branch 'hotfix/DEV-1_Stuff'" }
|
279
|
-
let(:change) { described_class.
|
541
|
+
let(:change) { described_class.from_gitlog(config, merge_str, ['DEV-1: Line 1', 'Line 2']) }
|
280
542
|
|
281
543
|
it 'removes the DevID and renders to markdown correctly' do
|
282
544
|
expect(change.to_md).to eq(" * Hotfix - DEV-1 - Line 1\n Line 2")
|
@@ -285,7 +547,7 @@ describe MrBump::Change do
|
|
285
547
|
|
286
548
|
context 'when given a change prefixed with a DevID seperated with a dash' do
|
287
549
|
let(:merge_str) { "Merge branch 'hotfix/DEV-1_Stuff'" }
|
288
|
-
let(:change) { described_class.
|
550
|
+
let(:change) { described_class.from_gitlog(config, merge_str, ['DEV-1 - Line 1', 'Line 2']) }
|
289
551
|
|
290
552
|
it 'removes the DevID and renders to markdown correctly' do
|
291
553
|
expect(change.to_md).to eq(" * Hotfix - DEV-1 - Line 1\n Line 2")
|
@@ -294,7 +556,7 @@ describe MrBump::Change do
|
|
294
556
|
|
295
557
|
context 'when given a change prefixed with a DevID seperated with a dash, and in square braces' do
|
296
558
|
let(:merge_str) { "Merge branch 'hotfix/DEV-1_Stuff'" }
|
297
|
-
let(:change) { described_class.
|
559
|
+
let(:change) { described_class.from_gitlog(config, merge_str, ['[DEV-1] - Line 1', 'Line 2']) }
|
298
560
|
|
299
561
|
it 'removes the DevID and renders to markdown correctly' do
|
300
562
|
expect(change.to_md).to eq(" * Hotfix - DEV-1 - Line 1\n Line 2")
|
@@ -303,7 +565,7 @@ describe MrBump::Change do
|
|
303
565
|
|
304
566
|
context 'when given a change prefixed with a DevID in square braces' do
|
305
567
|
let(:merge_str) { "Merge branch 'hotfix/DEV-1_Stuff'" }
|
306
|
-
let(:change) { described_class.
|
568
|
+
let(:change) { described_class.from_gitlog(config, merge_str, ['[DEV-1] Line 1', 'Line 2']) }
|
307
569
|
|
308
570
|
it 'removes the DevID and renders to markdown correctly' do
|
309
571
|
expect(change.to_md).to eq(" * Hotfix - DEV-1 - Line 1\n Line 2")
|
@@ -312,7 +574,7 @@ describe MrBump::Change do
|
|
312
574
|
|
313
575
|
context 'when given a change prefixed with a DevID in round braces' do
|
314
576
|
let(:merge_str) { "Merge branch 'hotfix/DEV-1_Stuff'" }
|
315
|
-
let(:change) { described_class.
|
577
|
+
let(:change) { described_class.from_gitlog(config, merge_str, ['(DEV-1) Line 1', 'Line 2']) }
|
316
578
|
|
317
579
|
it 'removes the DevID and renders to markdown correctly' do
|
318
580
|
expect(change.to_md).to eq(" * Hotfix - DEV-1 - Line 1\n Line 2")
|
@@ -321,7 +583,7 @@ describe MrBump::Change do
|
|
321
583
|
|
322
584
|
context 'when given a change prefixed with a DevID seperated by space only' do
|
323
585
|
let(:merge_str) { "Merge branch 'hotfix/DEV-1_Stuff'" }
|
324
|
-
let(:change) { described_class.
|
586
|
+
let(:change) { described_class.from_gitlog(config, merge_str, ['DEV-1 Line 1', 'Line 2']) }
|
325
587
|
|
326
588
|
it 'leaves the DevID and renders to markdown correctly' do
|
327
589
|
expect(change.to_md).to eq(" * Hotfix - DEV-1 - Line 1\n Line 2")
|
@@ -330,7 +592,7 @@ describe MrBump::Change do
|
|
330
592
|
|
331
593
|
context 'when given a change postfixed with a DevID in round braces' do
|
332
594
|
let(:merge_str) { "Merge branch 'hotfix/DEV-1_Stuff'" }
|
333
|
-
let(:change) { described_class.
|
595
|
+
let(:change) { described_class.from_gitlog(config, merge_str, ['Line 1 (DEV-1)', 'Line 2']) }
|
334
596
|
|
335
597
|
it 'leaves the DevID and renders to markdown correctly' do
|
336
598
|
expect(change.to_md).to eq(" * Hotfix - DEV-1 - Line 1 (DEV-1)\n Line 2")
|
@@ -339,7 +601,7 @@ describe MrBump::Change do
|
|
339
601
|
|
340
602
|
context 'when given a change with no description' do
|
341
603
|
let(:merge_str) { "Merge branch 'hotfix/DEV-1_Stuff'" }
|
342
|
-
let(:change) { described_class.
|
604
|
+
let(:change) { described_class.from_gitlog(config, merge_str, []) }
|
343
605
|
|
344
606
|
it 'renders to markdown correctly' do
|
345
607
|
expect(change.to_md).to eq(" * Hotfix - DEV-1 - ")
|
data/spec/slack_spec.rb
CHANGED
@@ -8,9 +8,11 @@ require 'mr_bump/slack'
|
|
8
8
|
describe MrBump::Slack do
|
9
9
|
let(:config) do
|
10
10
|
{
|
11
|
-
'
|
12
|
-
|
13
|
-
|
11
|
+
'slack' => {
|
12
|
+
'webhook_url' => webhook_url,
|
13
|
+
'username' => username,
|
14
|
+
'icon' => icons
|
15
|
+
}
|
14
16
|
}
|
15
17
|
end
|
16
18
|
let(:git_config) { {} }
|
@@ -94,4 +96,51 @@ describe MrBump::Slack do
|
|
94
96
|
end
|
95
97
|
end
|
96
98
|
end
|
99
|
+
|
100
|
+
describe '#jira_ids' do
|
101
|
+
let(:result) do
|
102
|
+
described_class.new(
|
103
|
+
{},
|
104
|
+
'slack' => { 'webhook_url' => 'dummy' },
|
105
|
+
'markdown_template' => ' * {{branch_type}} - {{dev_id}} - {{first_comment_line}}' \
|
106
|
+
"{{#comment_body}}\n {{.}}{{/comment_body}}"
|
107
|
+
).jira_ids(changes)
|
108
|
+
end
|
109
|
+
|
110
|
+
context 'when fed mixed changes in the default format' do
|
111
|
+
let(:changes) do
|
112
|
+
<<-CHANGES
|
113
|
+
* Task - HSDA-123 - jsldafbaksjdblkab
|
114
|
+
* Feature - QUAD-213 - asdbasn
|
115
|
+
* Bugfix - UKNO-17 - akssnjlsand;kajnsd
|
116
|
+
asmdhakjsdhgkaadsdasdsaafssdfgadfa
|
117
|
+
* Hotfix - Yo-421 - kjfnjdns
|
118
|
+
CHANGES
|
119
|
+
end
|
120
|
+
let(:devids) { ['HSDA-123', 'QUAD-213', 'UKNO-17', 'Yo-421'] }
|
121
|
+
|
122
|
+
it "extracts the DevID's where possible" do
|
123
|
+
expect(result).to eq(devids)
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
context "when fed mixed changes without DevID's" do
|
128
|
+
let(:changes) do
|
129
|
+
<<-CHANGES
|
130
|
+
* Task - HSDA-123 - jsldafbaksjdblkab
|
131
|
+
* Feature - asd213
|
132
|
+
* Bugfix - UKNO-17 - akssnjlsand;kajnsd
|
133
|
+
asmdhakjsdhgkaadsdasdsaafssdfgadfa
|
134
|
+
* Bugfix - akssnjlsand;kajnsd
|
135
|
+
asmdhakjsdhgkaadsdasdsaafssdfgadfa
|
136
|
+
* Hotfix - Yo-421 - kjfnjdns
|
137
|
+
CHANGES
|
138
|
+
end
|
139
|
+
let(:devids) { ['HSDA-123', 'UKNO-17', 'Yo-421'] }
|
140
|
+
|
141
|
+
it "extracts the DevID's where possible" do
|
142
|
+
expect(result).to eq(devids)
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
97
146
|
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.
|
4
|
+
version: 0.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Fitzgerald
|
@@ -29,30 +29,42 @@ dependencies:
|
|
29
29
|
name: octokit
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- -
|
32
|
+
- - ! '>='
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: '3.0'
|
35
|
+
- - <=
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '5.0'
|
35
38
|
type: :runtime
|
36
39
|
prerelease: false
|
37
40
|
version_requirements: !ruby/object:Gem::Requirement
|
38
41
|
requirements:
|
39
|
-
- -
|
42
|
+
- - ! '>='
|
40
43
|
- !ruby/object:Gem::Version
|
41
44
|
version: '3.0'
|
45
|
+
- - <=
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '5.0'
|
42
48
|
- !ruby/object:Gem::Dependency
|
43
49
|
name: mustache
|
44
50
|
requirement: !ruby/object:Gem::Requirement
|
45
51
|
requirements:
|
46
|
-
- -
|
52
|
+
- - ! '>='
|
47
53
|
- !ruby/object:Gem::Version
|
48
54
|
version: 0.99.3
|
55
|
+
- - <
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '2.0'
|
49
58
|
type: :runtime
|
50
59
|
prerelease: false
|
51
60
|
version_requirements: !ruby/object:Gem::Requirement
|
52
61
|
requirements:
|
53
|
-
- -
|
62
|
+
- - ! '>='
|
54
63
|
- !ruby/object:Gem::Version
|
55
64
|
version: 0.99.3
|
65
|
+
- - <
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '2.0'
|
56
68
|
- !ruby/object:Gem::Dependency
|
57
69
|
name: OptionParser
|
58
70
|
requirement: !ruby/object:Gem::Requirement
|
@@ -95,6 +107,20 @@ dependencies:
|
|
95
107
|
- - ! '>='
|
96
108
|
- !ruby/object:Gem::Version
|
97
109
|
version: '0'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: rb-readline
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - ! '>='
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
type: :development
|
118
|
+
prerelease: false
|
119
|
+
version_requirements: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - ! '>='
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '0'
|
98
124
|
- !ruby/object:Gem::Dependency
|
99
125
|
name: simplecov
|
100
126
|
requirement: !ruby/object:Gem::Requirement
|
@@ -179,6 +205,7 @@ files:
|
|
179
205
|
- lib/mr_bump/config.rb
|
180
206
|
- lib/mr_bump/git_api.rb
|
181
207
|
- lib/mr_bump/git_config.rb
|
208
|
+
- lib/mr_bump/regex_template.rb
|
182
209
|
- lib/mr_bump/slack.rb
|
183
210
|
- lib/mr_bump/version.rb
|
184
211
|
- spec/change_spec.rb
|