Class: Lazylead::Task::PropagateDown

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

Overview

Propagate particular JIRA fields from parent ticket to sub-tasks.

The task algorithm:

- fetch parent issues from remote ticketing system by JQL
- reject issues without sub-tasks
- fetch sub-tasks details
- make a diff for pre-defined fields provided by the user
- apply diff to sub-tasks
- make a comment to sub-task with clarification.

Instance Method Summary collapse

Constructor Details

#initialize(log = Log.new) ⇒ PropagateDown

Returns a new instance of PropagateDown.



43
44
45
# File 'lib/lazylead/task/propagate_down.rb', line 43

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

Instance Method Details

#run(sys, _, opts) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/lazylead/task/propagate_down.rb', line 49

def run(sys, _, opts)
  fields = opts.slice("propagate", ",")
  sys.issues(
    opts["jql"],
    {
      expand: "changelog",
      max_results: opts.fetch("max_results", 50),
      fields: ["subtasks"] + opts.jira_fields
    }
  )
     .map { |i| Parent.new(i, sys, fields) }
     .select(&:subtasks?)
     .each(&:fetch)
     .each(&:propagate)
end