Class: Abide::CLI::JiraFromXccdfDiffCommand
- Inherits:
-
CmdParse::Command
- Object
- CmdParse::Command
- Abide::CLI::JiraFromXccdfDiffCommand
- Defined in:
- lib/abide_dev_utils/cli/jira.rb
Constant Summary collapse
- CMD_NAME =
'from-xccdf-diff'
- CMD_SHORT =
'Creates an Epic with tasks from a xccdf diff'
- CMD_LONG =
'Creates an Epic with tasks for changes in a diff of two XCCDF files'
Instance Method Summary collapse
- #execute(path1, path2, project) ⇒ Object
-
#initialize ⇒ JiraFromXccdfDiffCommand
constructor
A new instance of JiraFromXccdfDiffCommand.
Constructor Details
#initialize ⇒ JiraFromXccdfDiffCommand
Returns a new instance of JiraFromXccdfDiffCommand.
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 |
# File 'lib/abide_dev_utils/cli/jira.rb', line 154 def initialize super(CMD_NAME, takes_commands: false) short_desc(CMD_SHORT) long_desc(CMD_LONG) argument_desc(PATH1: 'An XCCDF file', PATH2: 'An XCCDF file', PROJECT: 'A Jira project') .on('-d', '--dry-run', 'Print to console instead of saving objects') { |_| @data[:dry_run] = true } .on('-y', '--yes', 'Automatically approve all yes / no prompts') { |_| @data[:auto_approve] = true } .on('-e [EPIC]', '--epic [EPIC]', 'If given, tasks will be created and assigned to this epic. Takes form <PROJECT>-<NUM>') { |e| @data[:epic] = e } .on('-p [PROFILE]', '--profile', 'Only diff rules belonging to the matching profile. Takes a string that is treated as RegExp') do |x| @data[:diff_opts] ||= {} @data[:diff_opts][:profile] = x end .on('-l [LEVEL]', '--level', 'Only diff rules belonging to the matching level. Takes a string that is treated as RegExp') do |x| @data[:diff_opts] ||= {} @data[:diff_opts][:level] = x end .on('-i [PROPS]', '--ignore-changed-properties', 'Ignore changes to specified properties. Takes a comma-separated list.') do |x| @data[:diff_opts] ||= {} @data[:diff_opts][:ignore_changed_properties] = x.split(',') end end |
Instance Method Details
#execute(path1, path2, project) ⇒ Object
176 177 178 179 180 181 182 183 184 185 186 187 188 |
# File 'lib/abide_dev_utils/cli/jira.rb', line 176 def execute(path1, path2, project) Abide::CLI::VALIDATE.file(path1) Abide::CLI::VALIDATE.file(path2) AbideDevUtils::Jira.new_issues_from_xccdf_diff( project, path1, path2, epic: @data[:epic], dry_run: @data[:dry_run], auto_approve: @data[:auto_approve], diff_opts: @data[:diff_opts], ) end |