lazylead 0.1.1 → 0.4.0
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 +4 -4
- data/.0pdd.yml +4 -1
- data/.circleci/config.yml +19 -7
- data/.circleci/release_image.sh +6 -3
- data/.docker/Dockerfile +10 -9
- data/.docker/docker-compose.yml +3 -3
- data/.docker/readme.md +24 -21
- data/.docker/vcs.dockerfile +10 -0
- data/.docs/accuracy.md +107 -0
- data/.docs/accuracy_email.jpg +0 -0
- data/.docs/accuracy_jira_comment.jpg +0 -0
- data/.docs/duedate_expired.md +92 -0
- data/.docs/propagate_down.md +89 -0
- data/.pdd +1 -1
- data/.rubocop.yml +7 -1
- data/.rultor.yml +13 -14
- data/.simplecov +0 -6
- data/Rakefile +38 -1
- data/bin/lazylead +13 -5
- data/lazylead.gemspec +6 -17
- data/lib/lazylead/cc.rb +180 -0
- data/lib/lazylead/cli/app.rb +4 -3
- data/lib/lazylead/exchange.rb +15 -2
- data/lib/lazylead/home.rb +38 -0
- data/lib/lazylead/log.rb +30 -8
- data/lib/lazylead/model.rb +60 -16
- data/lib/lazylead/opts.rb +68 -0
- data/lib/lazylead/postman.rb +15 -15
- data/lib/lazylead/schedule.rb +6 -4
- data/lib/lazylead/smtp.rb +1 -1
- data/lib/lazylead/system/fake.rb +1 -1
- data/lib/lazylead/system/jira.rb +55 -12
- data/lib/lazylead/system/synced.rb +2 -1
- data/lib/lazylead/task/accuracy/accuracy.rb +140 -0
- data/lib/lazylead/task/accuracy/affected_build.rb +43 -0
- data/lib/lazylead/task/accuracy/requirement.rb +40 -0
- data/lib/lazylead/task/alert.rb +8 -6
- data/lib/lazylead/task/confluence_ref.rb +4 -3
- data/lib/lazylead/task/echo.rb +4 -0
- data/lib/lazylead/task/fix_version.rb +11 -7
- data/lib/lazylead/task/missing_comment.rb +7 -5
- data/lib/lazylead/task/propagate_down.rb +126 -0
- data/lib/lazylead/task/savepoint.rb +58 -0
- data/lib/lazylead/task/touch.rb +102 -0
- data/lib/lazylead/version.rb +1 -1
- data/lib/messages/accuracy.erb +118 -0
- data/lib/messages/due_date_expired.erb +8 -7
- data/lib/messages/illegal_fixversion_change.erb +9 -8
- data/lib/messages/missing_comment.erb +10 -9
- data/lib/messages/savepoint.erb +43 -0
- data/lib/messages/svn_touch.erb +147 -0
- data/readme.md +90 -80
- data/test/lazylead/cc_test.rb +153 -0
- data/test/lazylead/cli/app_test.rb +3 -4
- data/test/lazylead/exchange_test.rb +22 -2
- data/test/lazylead/model_test.rb +14 -3
- data/test/lazylead/opts_test.rb +66 -0
- data/test/lazylead/postman_test.rb +57 -0
- data/test/lazylead/smtp_test.rb +1 -1
- data/test/lazylead/system/jira_test.rb +43 -1
- data/test/lazylead/task/accuracy/accuracy_test.rb +73 -0
- data/test/lazylead/task/accuracy/affected_build_test.rb +42 -0
- data/test/lazylead/task/assignee_alert_test.rb +47 -0
- data/test/lazylead/task/duedate_test.rb +52 -30
- data/test/lazylead/task/fix_version_test.rb +11 -10
- data/test/lazylead/task/missing_comment_test.rb +13 -13
- data/test/lazylead/task/propagate_down_test.rb +88 -0
- data/test/lazylead/task/savepoint_test.rb +51 -0
- data/test/lazylead/task/touch_test.rb +63 -0
- data/test/test.rb +11 -0
- data/upgrades/sqlite/001-install-main-lazylead-tables.sql +3 -4
- data/upgrades/sqlite/999.testdata.sql +8 -2
- metadata +57 -177
- data/deploy.sh +0 -16
- data/todo.yml +0 -6
data/lib/lazylead/system/fake.rb
CHANGED
data/lib/lazylead/system/jira.rb
CHANGED
@@ -23,6 +23,7 @@
|
|
23
23
|
# OR OTHER DEALINGS IN THE SOFTWARE.
|
24
24
|
|
25
25
|
require "jira-ruby"
|
26
|
+
require "forwardable"
|
26
27
|
require_relative "../salt"
|
27
28
|
|
28
29
|
module Lazylead
|
@@ -35,7 +36,7 @@ module Lazylead
|
|
35
36
|
# @todo #57/DEV The debug method should be moved outside of ctor.
|
36
37
|
# This was moved here from 'client' method because Rubocop failed the build
|
37
38
|
# due to 'Metrics/AbcSize' violation.
|
38
|
-
def initialize(opts, salt = NoSalt.new, log = Log
|
39
|
+
def initialize(opts, salt = NoSalt.new, log = Log.new)
|
39
40
|
@opts = opts
|
40
41
|
@salt = salt
|
41
42
|
@log = log
|
@@ -46,7 +47,7 @@ module Lazylead
|
|
46
47
|
|
47
48
|
def issues(jql, opts = {})
|
48
49
|
raw do |jira|
|
49
|
-
jira.Issue.jql(jql, opts).map { |i| Lazylead::Issue.new(i) }
|
50
|
+
jira.Issue.jql(jql, opts).map { |i| Lazylead::Issue.new(i, jira) }
|
50
51
|
end
|
51
52
|
end
|
52
53
|
|
@@ -136,8 +137,9 @@ module Lazylead
|
|
136
137
|
# Copyright:: Copyright (c) 2019-2020 Yurii Dubinka
|
137
138
|
# License:: MIT
|
138
139
|
class Issue
|
139
|
-
def initialize(issue)
|
140
|
+
def initialize(issue, jira)
|
140
141
|
@issue = issue
|
142
|
+
@jira = jira
|
141
143
|
end
|
142
144
|
|
143
145
|
def id
|
@@ -183,7 +185,10 @@ module Lazylead
|
|
183
185
|
end
|
184
186
|
|
185
187
|
def comments
|
186
|
-
@
|
188
|
+
return @comments if defined? @comments
|
189
|
+
@comments = @jira.Issue.find(@issue.id, expand: "comments", fields: "")
|
190
|
+
.comments
|
191
|
+
.map { |c| Comment.new(c) }
|
187
192
|
end
|
188
193
|
|
189
194
|
def to_s
|
@@ -193,6 +198,14 @@ module Lazylead
|
|
193
198
|
def inspect
|
194
199
|
to_s
|
195
200
|
end
|
201
|
+
|
202
|
+
def status
|
203
|
+
@issue.status.attrs["name"]
|
204
|
+
end
|
205
|
+
|
206
|
+
def post(markdown)
|
207
|
+
@issue.comments.build.save!(body: markdown)
|
208
|
+
end
|
196
209
|
end
|
197
210
|
|
198
211
|
# The jira issue comments
|
@@ -224,26 +237,56 @@ module Lazylead
|
|
224
237
|
end
|
225
238
|
end
|
226
239
|
|
240
|
+
# Comment in jira ticket
|
241
|
+
class Comment
|
242
|
+
def initialize(comment)
|
243
|
+
@comment = comment
|
244
|
+
end
|
245
|
+
|
246
|
+
# Check that comment has expected text
|
247
|
+
def include?(text)
|
248
|
+
@comment.attrs["body"].include? text
|
249
|
+
end
|
250
|
+
end
|
251
|
+
|
227
252
|
# Jira instance without authentication in order to access public filters
|
228
253
|
# or dashboards.
|
229
254
|
class NoAuthJira
|
230
|
-
|
255
|
+
extend Forwardable
|
256
|
+
def_delegators :@jira, :issues, :raw
|
257
|
+
|
258
|
+
def initialize(url, path = "", log = Log.new)
|
231
259
|
@jira = Jira.new(
|
232
|
-
{
|
260
|
+
{
|
261
|
+
username: nil,
|
262
|
+
password: nil,
|
263
|
+
site: url,
|
264
|
+
context_path: path
|
265
|
+
},
|
233
266
|
NoSalt.new,
|
234
267
|
log
|
235
268
|
)
|
236
269
|
end
|
270
|
+
end
|
237
271
|
|
238
|
-
|
239
|
-
|
272
|
+
# A fake jira system which allows to work with sub-tasks.
|
273
|
+
class Fake
|
274
|
+
def initialize(issues)
|
275
|
+
@issues = issues
|
276
|
+
end
|
277
|
+
|
278
|
+
def issues(*)
|
279
|
+
@issues
|
240
280
|
end
|
241
281
|
|
242
282
|
# Execute request to the ticketing system using raw client.
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
283
|
+
def raw
|
284
|
+
raise "ll-08: No block given to method" unless block_given?
|
285
|
+
yield(OpenStruct.new(Issue: self))
|
286
|
+
end
|
287
|
+
|
288
|
+
def find(id)
|
289
|
+
@issues.detect { |i| i.id.eql? id }
|
247
290
|
end
|
248
291
|
end
|
249
292
|
end
|
@@ -30,7 +30,8 @@ module Lazylead
|
|
30
30
|
@sys = sys
|
31
31
|
end
|
32
32
|
|
33
|
-
# @todo #/DEV Unit tests for 'issues' function
|
33
|
+
# @todo #/DEV Unit tests for 'issues' function, moreover the other methods
|
34
|
+
# from ticketing system obj are required
|
34
35
|
#
|
35
36
|
def issues(jql)
|
36
37
|
@mutex.synchronize do
|
@@ -0,0 +1,140 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# The MIT License
|
4
|
+
#
|
5
|
+
# Copyright (c) 2019-2020 Yurii Dubinka
|
6
|
+
#
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
# of this software and associated documentation files (the "Software"),
|
9
|
+
# to deal in the Software without restriction, including without limitation
|
10
|
+
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
11
|
+
# and/or sell copies of the Software, and to permit persons to whom
|
12
|
+
# the Software is furnished to do so, subject to the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be included
|
15
|
+
# in all copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
22
|
+
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
|
23
|
+
# OR OTHER DEALINGS IN THE SOFTWARE.
|
24
|
+
|
25
|
+
require_relative "../../log"
|
26
|
+
require_relative "../../opts"
|
27
|
+
require_relative "../../email"
|
28
|
+
require_relative "../../version"
|
29
|
+
require_relative "../../postman"
|
30
|
+
|
31
|
+
module Lazylead
|
32
|
+
module Task
|
33
|
+
#
|
34
|
+
# Evaluate ticket format and accuracy
|
35
|
+
#
|
36
|
+
# The task supports the following features:
|
37
|
+
# - fetch issues from remote ticketing system by query
|
38
|
+
# - evaluate each field within the ticket
|
39
|
+
# - post the score to the ticket
|
40
|
+
class Accuracy
|
41
|
+
def initialize(log = Log.new)
|
42
|
+
@log = log
|
43
|
+
end
|
44
|
+
|
45
|
+
def run(sys, postman, opts)
|
46
|
+
require_rules
|
47
|
+
rules = opts.slice("rules", ",")
|
48
|
+
.map(&:constantize)
|
49
|
+
.map(&:new)
|
50
|
+
raised = sys.issues(opts["jql"], opts.jira_defaults)
|
51
|
+
.map { |i| Score.new(i, opts, rules) }
|
52
|
+
.each(&:evaluate)
|
53
|
+
.each(&:post)
|
54
|
+
postman.send opts.merge(tickets: raised) unless raised.empty?
|
55
|
+
end
|
56
|
+
|
57
|
+
# Load all ticket accuracy rules for future verification
|
58
|
+
def require_rules
|
59
|
+
rules = File.dirname(__FILE__)
|
60
|
+
$LOAD_PATH.unshift(rules) unless $LOAD_PATH.include?(rules)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# The ticket score based on fields content.
|
66
|
+
class Score
|
67
|
+
attr_reader :issue, :total, :score, :accuracy
|
68
|
+
|
69
|
+
def initialize(issue, opts, rules)
|
70
|
+
@issue = issue
|
71
|
+
@link = opts["docs"]
|
72
|
+
@opts = opts
|
73
|
+
@rules = rules
|
74
|
+
end
|
75
|
+
|
76
|
+
# Estimate the ticket score and accuracy.
|
77
|
+
# Accuracy is a percentage between current score and maximum possible value.
|
78
|
+
def evaluate(digits = 2)
|
79
|
+
@total = @rules.map(&:score).sum
|
80
|
+
@score = @rules.select { |r| r.passed(@issue) }
|
81
|
+
.map(&:score)
|
82
|
+
.sum
|
83
|
+
@accuracy = (score / @total * 100).round(digits)
|
84
|
+
end
|
85
|
+
|
86
|
+
# Post the comment with score and accuracy to the ticket.
|
87
|
+
def post
|
88
|
+
@issue.post(comment) unless @opts.key? "silent"
|
89
|
+
end
|
90
|
+
|
91
|
+
# The jira comment in markdown format
|
92
|
+
def comment
|
93
|
+
comment = [
|
94
|
+
"Hi [~#{@issue.reporter.id}],",
|
95
|
+
"",
|
96
|
+
"The triage accuracy is '{color:#{color}}#{@score}{color}'" \
|
97
|
+
" (~{color:#{color}}#{@accuracy}%{color}), here are the reasons why:",
|
98
|
+
"|| Ticket requirement || Status || Field ||"
|
99
|
+
]
|
100
|
+
@rules.each do |r|
|
101
|
+
comment << "|#{r.desc}|#{r.passed(@issue) ? '(/)' : '(-)'}|#{r.field}|"
|
102
|
+
end
|
103
|
+
comment << docs_link
|
104
|
+
comment << ""
|
105
|
+
comment << "Posted by [lazylead v#{Lazylead::VERSION}|" \
|
106
|
+
"https://bit.ly/2NjdndS]."
|
107
|
+
comment.join("\r\n")
|
108
|
+
end
|
109
|
+
|
110
|
+
# Link to ticket formatting rules
|
111
|
+
def docs_link
|
112
|
+
if @link.nil? || @link.blank?
|
113
|
+
""
|
114
|
+
else
|
115
|
+
"The requirements/examples of ticket formatting rules you may find " \
|
116
|
+
"[here|#{@link}]."
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
def color
|
121
|
+
if colors.nil? || !defined?(@score) || !@score.is_a?(Numeric)
|
122
|
+
return "#061306"
|
123
|
+
end
|
124
|
+
colors.reverse_each do |color|
|
125
|
+
return color.last if @accuracy >= color.first
|
126
|
+
end
|
127
|
+
"#061306"
|
128
|
+
end
|
129
|
+
|
130
|
+
def colors
|
131
|
+
@colors ||= begin
|
132
|
+
JSON.parse(@opts["colors"])
|
133
|
+
.to_h
|
134
|
+
.to_a
|
135
|
+
.each { |e| e[0] = e[0].to_i }
|
136
|
+
.sort_by { |e| e[0] }
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# The MIT License
|
4
|
+
#
|
5
|
+
# Copyright (c) 2019-2020 Yurii Dubinka
|
6
|
+
#
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
# of this software and associated documentation files (the "Software"),
|
9
|
+
# to deal in the Software without restriction, including without limitation
|
10
|
+
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
11
|
+
# and/or sell copies of the Software, and to permit persons to whom
|
12
|
+
# the Software is furnished to do so, subject to the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be included
|
15
|
+
# in all copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
22
|
+
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
|
23
|
+
# OR OTHER DEALINGS IN THE SOFTWARE.
|
24
|
+
|
25
|
+
require_relative "../../log"
|
26
|
+
require_relative "../../email"
|
27
|
+
require_relative "../../version"
|
28
|
+
require_relative "../../postman"
|
29
|
+
require_relative "requirement"
|
30
|
+
|
31
|
+
module Lazylead
|
32
|
+
# A requirement that Jira field "Affects Version/s" provided by the reporter.
|
33
|
+
class RequirementAffectedBuild < Requirement
|
34
|
+
def initialize(score = 0.5)
|
35
|
+
super "Affected build", score, "Affects Version/s"
|
36
|
+
end
|
37
|
+
|
38
|
+
# @return true if an issue has non-empty "Affects Version/s" field
|
39
|
+
def passed(issue)
|
40
|
+
!issue.fields["versions"].nil? && !issue.fields["versions"].empty?
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# The MIT License
|
4
|
+
#
|
5
|
+
# Copyright (c) 2019-2020 Yurii Dubinka
|
6
|
+
#
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
# of this software and associated documentation files (the "Software"),
|
9
|
+
# to deal in the Software without restriction, including without limitation
|
10
|
+
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
11
|
+
# and/or sell copies of the Software, and to permit persons to whom
|
12
|
+
# the Software is furnished to do so, subject to the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be included
|
15
|
+
# in all copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
22
|
+
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
|
23
|
+
# OR OTHER DEALINGS IN THE SOFTWARE.
|
24
|
+
|
25
|
+
module Lazylead
|
26
|
+
# An single requirement regarding ticket format.
|
27
|
+
class Requirement
|
28
|
+
attr_reader :score, :desc, :field
|
29
|
+
|
30
|
+
def initialize(desc, score, field)
|
31
|
+
@desc = desc
|
32
|
+
@score = score
|
33
|
+
@field = field
|
34
|
+
end
|
35
|
+
|
36
|
+
def passed(_)
|
37
|
+
true
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
data/lib/lazylead/task/alert.rb
CHANGED
@@ -23,6 +23,7 @@
|
|
23
23
|
# OR OTHER DEALINGS IN THE SOFTWARE.
|
24
24
|
|
25
25
|
require_relative "../log"
|
26
|
+
require_relative "../opts"
|
26
27
|
require_relative "../email"
|
27
28
|
require_relative "../version"
|
28
29
|
require_relative "../postman"
|
@@ -43,12 +44,13 @@ module Lazylead
|
|
43
44
|
# - prepare email based on predefined template (*.erb)
|
44
45
|
# - send the required notifications pre-defined "addressee".
|
45
46
|
class Alert
|
46
|
-
def initialize(log = Log
|
47
|
+
def initialize(log = Log.new)
|
47
48
|
@log = log
|
48
49
|
end
|
49
50
|
|
50
51
|
def run(sys, postman, opts)
|
51
|
-
|
52
|
+
tickets = sys.issues(opts["sql"], opts.jira_defaults)
|
53
|
+
postman.send opts.merge(tickets: tickets) unless tickets.empty?
|
52
54
|
end
|
53
55
|
end
|
54
56
|
|
@@ -64,12 +66,12 @@ module Lazylead
|
|
64
66
|
# The email message is sending to the assignee regarding all his/her issues,
|
65
67
|
# not like one email per each issue.
|
66
68
|
class AssigneeAlert
|
67
|
-
def initialize(log = Log
|
69
|
+
def initialize(log = Log.new)
|
68
70
|
@log = log
|
69
71
|
end
|
70
72
|
|
71
73
|
def run(sys, postman, opts)
|
72
|
-
sys.issues(opts["sql"])
|
74
|
+
sys.issues(opts["sql"], opts.jira_defaults)
|
73
75
|
.group_by(&:assignee)
|
74
76
|
.each do |a, t|
|
75
77
|
postman.send opts.merge(to: a.email, addressee: a.name, tickets: t)
|
@@ -89,12 +91,12 @@ module Lazylead
|
|
89
91
|
# The email message is sending to the assignee regarding all his/her issues,
|
90
92
|
# not like one email per each issue.
|
91
93
|
class ReporterAlert
|
92
|
-
def initialize(log = Log
|
94
|
+
def initialize(log = Log.new)
|
93
95
|
@log = log
|
94
96
|
end
|
95
97
|
|
96
98
|
def run(sys, postman, opts)
|
97
|
-
sys.issues(opts["sql"])
|
99
|
+
sys.issues(opts["sql"], opts.jira_defaults)
|
98
100
|
.group_by(&:reporter)
|
99
101
|
.each do |a, t|
|
100
102
|
postman.send opts.merge(to: a.email, addressee: a.name, tickets: t)
|
@@ -26,6 +26,7 @@ require "json"
|
|
26
26
|
require "faraday"
|
27
27
|
require_relative "../system/jira"
|
28
28
|
require_relative "../log"
|
29
|
+
require_relative "../opts"
|
29
30
|
require_relative "../confluence"
|
30
31
|
|
31
32
|
module Lazylead
|
@@ -35,14 +36,14 @@ module Lazylead
|
|
35
36
|
# @todo #/DEV Support sub-task for link search. Potentially, the issue
|
36
37
|
# might have sub-tasks where discussion ongoing.
|
37
38
|
class ConfluenceRef
|
38
|
-
def initialize(log = Log
|
39
|
+
def initialize(log = Log.new)
|
39
40
|
@log = log
|
40
41
|
end
|
41
42
|
|
42
43
|
def run(sys, _, opts)
|
43
44
|
confluences = confluences(opts)
|
44
45
|
return if confluences.empty?
|
45
|
-
sys.issues(opts["jql"])
|
46
|
+
sys.issues(opts["jql"], opts.jira_defaults)
|
46
47
|
.map { |i| Link.new(i, sys, confluences) }
|
47
48
|
.each(&:fetch_links)
|
48
49
|
.select(&:need_link?)
|
@@ -50,7 +51,7 @@ module Lazylead
|
|
50
51
|
end
|
51
52
|
|
52
53
|
def confluences(opts)
|
53
|
-
return [] if opts
|
54
|
+
return [] if opts.blank? "confluences"
|
54
55
|
JSON.parse(opts["confluences"], object_class: OpenStruct)
|
55
56
|
.map { |c| Confluence.new(c) }
|
56
57
|
end
|