Class: Abide::CLI::JiraFromXccdfCommand

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

Constant Summary collapse

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

Instance Method Summary collapse

Constructor Details

#initializeJiraFromXccdfCommand

Returns a new instance of JiraFromXccdfCommand.



123
124
125
126
127
128
129
130
# File 'lib/abide_dev_utils/cli/jira.rb', line 123

def initialize
  super(CMD_NAME, takes_commands: false)
  short_desc(CMD_SHORT)
  long_desc(CMD_LONG)
  argument_desc(PATH: 'An XCCDF file', PROJECT: 'A Jira project')
  options.on('-d', '--dry-run', 'Print to console instead of saving objects') { |_| @data[:dry_run] = true }
  options.on('-e [EPIC]', '--epic [EPIC]', 'If given, tasks will be created and assigned to this epic. Takes form <PROJECT>-<NUM>') { |e| @data[:epic] = e }
end

Instance Method Details

#execute(path, project) ⇒ Object



132
133
134
135
136
137
138
# File 'lib/abide_dev_utils/cli/jira.rb', line 132

def execute(path, project)
  Abide::CLI::VALIDATE.file(path)
  @data[:dry_run] = false if @data[:dry_run].nil?
  client = JIRA.client(options: {})
  proj = JIRA.project(client, project)
  JIRA.new_issues_from_xccdf(client, proj, path, epic: @data[:epic], dry_run: @data[:dry_run])
end