Class: Abide::CLI::JiraFromCoverageCommand
- Inherits:
-
CmdParse::Command
- Object
- CmdParse::Command
- Abide::CLI::JiraFromCoverageCommand
- 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
- #execute(report, project) ⇒ Object
-
#initialize ⇒ JiraFromCoverageCommand
constructor
A new instance of JiraFromCoverageCommand.
Constructor Details
#initialize ⇒ JiraFromCoverageCommand
Returns a new instance of JiraFromCoverageCommand.
100 101 102 103 104 105 106 |
# File 'lib/abide_dev_utils/cli/jira.rb', line 100 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') .on('-d', '--dry-run', 'Print to console instead of saving objects') { |_| @data[:dry_run] = true } end |
Instance Method Details
#execute(report, project) ⇒ Object
108 109 110 111 112 113 114 115 116 |
# File 'lib/abide_dev_utils/cli/jira.rb', line 108 def execute(report, project) Abide::CLI::VALIDATE.file(report) @data[:dry_run] = false if @data[:dry_run].nil? client = JIRA.client(options: {}) proj = JIRA.project(client, project) File.open(report) do |f| JIRA.new_issues_from_coverage(client, proj, JSON.parse(f.read), dry_run: @data[:dry_run]) end end |