Class: Lazylead::Task::Assignment

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

Overview

Email alerts about illegal issue assignment(s).

Author

Yurii Dubinka ([email protected])

Copyright

Copyright © 2019-2020 Yurii Dubinka

License

MIT

Instance Method Summary collapse

Constructor Details

#initialize(log = Log.new) ⇒ Assignment

Returns a new instance of Assignment.



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

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

Instance Method Details

#run(sys, postman, opts) ⇒ Object



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

def run(sys, postman, opts)
  allowed = opts.slice "allowed", ","
  silent = opts.key? "silent"
  assignees = sys.issues(opts["jql"], opts.jira_defaults.merge(expand: "changelog"))
                 .map { |i| Assignee.new(i, allowed, silent) }
                 .select(&:illegal?)
                 .each(&:add_label)
  return if assignees.empty?
  postman.send opts.merge(assignees: assignees)
end