Class: Lazylead::Task::ConfluenceRef

Inherits:
Object
  • Object
show all
Defined in:
lib/lazylead/task/confluence_ref.rb

Overview

TODO:

#/DEV Support sub-task for link search. Potentially, the issue might have sub-tasks where discussion ongoing.

The lazylead task which adds reference to Confluence page

in case if Confluence page was mentioned in issue comments.

Instance Method Summary collapse

Constructor Details

#initialize(log = Log.new) ⇒ ConfluenceRef

Returns a new instance of ConfluenceRef.



39
40
41
# File 'lib/lazylead/task/confluence_ref.rb', line 39

def initialize(log = Log.new)
  @log = log
end

Instance Method Details

#confluences(opts) ⇒ Object



53
54
55
56
57
# File 'lib/lazylead/task/confluence_ref.rb', line 53

def confluences(opts)
  return [] if opts.blank? "confluences"
  JSON.parse(opts["confluences"], object_class: OpenStruct)
      .map { |c| Confluence.new(c) }
end

#run(sys, _, opts) ⇒ Object



43
44
45
46
47
48
49
50
51
# File 'lib/lazylead/task/confluence_ref.rb', line 43

def run(sys, _, opts)
  confluences = confluences(opts)
  return if confluences.empty?
  sys.issues(opts["jql"], opts.jira_defaults)
     .map { |i| Link.new(i, sys, confluences) }
     .each(&:fetch_links)
     .select(&:need_link?)
     .each(&:add_link)
end