Class: Abide::CLI::JiraFromCoverageCommand

Inherits:
CmdParse::Command
  • Object
show all
Defined in:
lib/abide_dev_utils/cli/jira.rb

Constant Summary collapse

CMD_NAME =
'from-coverage'
CMD_SHORT =
'Creates a parent issue with subtasks from a coverage report'
CMD_LONG =
'Creates a parent issue with subtasks for a benchmark and any uncovered controls'

Instance Method Summary collapse

Constructor Details

#initializeJiraFromCoverageCommand

Returns a new instance of JiraFromCoverageCommand.



96
97
98
99
100
101
102
# File 'lib/abide_dev_utils/cli/jira.rb', line 96

def initialize
  super(CMD_NAME, takes_commands: false)
  short_desc(CMD_SHORT)
  long_desc(CMD_LONG)
  argument_desc(REPORT: 'A JSON coverage report from the abide puppet coverage command', PROJECT: 'A Jira project')
  options.on('-d', '--dry-run', 'Print to console instead of saving objects') { |_| @data[:dry_run] = true }
end

Instance Method Details

#execute(report, project) ⇒ Object



104
105
106
107
108
109
# File 'lib/abide_dev_utils/cli/jira.rb', line 104

def execute(report, project)
  Abide::CLI::VALIDATE.file(report)
  File.open(report) do |f|
    AbideDevUtils::Jira.new_issues_from_coverage(project, JSON.parse(f.read), dry_run: @data[:dry_run])
  end
end