Class: Abide::CLI::JiraNewIssueCommand
- Inherits:
-
CmdParse::Command
- Object
- CmdParse::Command
- Abide::CLI::JiraNewIssueCommand
- Defined in:
- lib/abide_dev_utils/cli/jira.rb
Constant Summary collapse
- CMD_NAME =
'new-issue'
- CMD_SHORT =
'Creates a new issue in a project'
- CMD_LONG =
'Allows you to create a new issue in a project'
Instance Method Summary collapse
- #execute(project, summary, *subtasks) ⇒ Object
-
#initialize ⇒ JiraNewIssueCommand
constructor
A new instance of JiraNewIssueCommand.
Constructor Details
#initialize ⇒ JiraNewIssueCommand
Returns a new instance of JiraNewIssueCommand.
74 75 76 77 78 79 80 81 82 83 |
# File 'lib/abide_dev_utils/cli/jira.rb', line 74 def initialize super(CMD_NAME, takes_commands: false) short_desc(CMD_SHORT) long_desc(CMD_LONG) argument_desc( PROJECT: 'Jira project name (should be all caps)', SUMMARY: 'Brief summary of the issue', SUBTASKS: 'One or more summaries that become subtasks' ) end |
Instance Method Details
#execute(project, summary, *subtasks) ⇒ Object
85 86 87 88 89 90 91 92 93 |
# File 'lib/abide_dev_utils/cli/jira.rb', line 85 def execute(project, summary, *subtasks) client = JIRA.client(options: {}) issue = JIRA.new_issue(client, project, summary) Abide::CLI::OUTPUT.simple("Successfully created #{issue.attrs['key']}") return if subtasks.nil? || subtasks.empty? Abide::CLI::OUTPUT.simple('Creatings subtasks...') JIRA.bulk_new_subtask(client, JIRA.issue(client, issue.attrs['key']), subtasks) unless subtasks.empty? end |