Class: Lazylead::Task::FixVersion

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

Overview

TODO:

#/DEV Each task should verify input arguments. The common API should be provided for each task.

Instance Method Summary collapse

Constructor Details

#initialize(log = Log.new) ⇒ FixVersion

Returns a new instance of FixVersion.



35
36
37
# File 'lib/lazylead/task/fix_version.rb', line 35

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

Instance Method Details

#run(sys, postman, opts) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/lazylead/task/fix_version.rb', line 39

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